Skip to content

Commit

Permalink
[handlers] Custom Jira project per-alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Fedorov committed Mar 17, 2020
1 parent 6a1d258 commit 02d3ac2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runners/handlers/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def bail_out(alert_id):
log.error(e, f"Failed to update alert {alert_id} with handler status")


def handle(alert, correlation_id, project=PROJECT, assignee=None, custom_field=None):
def handle(alert, correlation_id, project=PROJECT, assignee=None, custom_field=None, issue_type=ISSUE_TYPE):
if project == '':
return "No Jira Project defined"
if URL == '':
Expand Down Expand Up @@ -211,15 +211,15 @@ def handle(alert, correlation_id, project=PROJECT, assignee=None, custom_field=N
f"Failed to append alert {alert_id} to ticket {ticket_id}.", e
)
try:
ticket_id = create_jira_ticket(alert, project=project)
ticket_id = create_jira_ticket(alert, project=project, issue_type=issue_type)
except Exception as e:
log.error(e, f"Failed to create ticket for alert {alert_id}")
raise
else:
# There is no correlation with a ticket that exists
# Create a new ticket in JIRA for the alert
try:
ticket_id = create_jira_ticket(alert, assignee, custom_field, project=project)
ticket_id = create_jira_ticket(alert, assignee, custom_field, project=project, issue_type=issue_type)
except Exception as e:
log.error(e, f"Failed to create ticket for alert {alert_id}")
raise
Expand Down

0 comments on commit 02d3ac2

Please sign in to comment.