Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for existence of keys in serialized incident before accessing #19

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/argus_ticket_rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ def get_custom_fields(ticket_information: dict, serialized_incident: dict) -> di
for key, field in custom_fields_mapping.items():
if type(field) is dict:
# Information can be found in tags
custom_fields[key] = incident_tags[field["tag"]]
custom_field = incident_tags.get(field["tag"], None)
if custom_field:
custom_fields[key] = custom_field
else:
# Infinity means that the incident is still open
if serialized_incident[field] == "infinity":
continue
custom_fields[key] = serialized_incident[field]
custom_field = serialized_incident.get(field, None)
if custom_field:
# Infinity means that the incident is still open
if custom_field == "infinity":
continue
custom_fields[key] = custom_field

return custom_fields

Expand Down