Skip to content

Commit

Permalink
Merge pull request #28 from Uninett/bugfix/end-time-gets-saved
Browse files Browse the repository at this point in the history
Avoid ticket_information being changed during previous ticket creation
  • Loading branch information
johannaengland authored Jun 20, 2024
2 parents 138e1bc + 8ce94a7 commit 4164188
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/argus_ticket_rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ def get_custom_fields(
serialized_incident["end_time"] = serialized_incident["end_time"][:-6]
else:
del serialized_incident["end_time"]

incident_tags = RequestTrackerPlugin.convert_tags_to_dict(
serialized_incident["tags"]
)
custom_fields = ticket_information.get("custom_fields_set", {})
custom_fields = dict()
custom_fields.update(ticket_information.get("custom_fields_set", {}))
custom_fields_mapping = ticket_information.get("custom_fields_mapping", {})
missing_fields = []

for key, field in custom_fields_mapping.items():
if type(field) is dict:
if isinstance(field, dict):
# Information can be found in tags
custom_field = incident_tags.get(field["tag"], None)
if custom_field:
Expand All @@ -82,7 +84,7 @@ def get_custom_fields(
custom_field = serialized_incident.get(field, None)
if custom_field:
custom_fields[key] = custom_field
else:
elif field != "end_time":
missing_fields.append(field)

return custom_fields, missing_fields
Expand Down

0 comments on commit 4164188

Please sign in to comment.