You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If a pagerduty escalation policy entry does not contain a schedule, Dispatch fails to find the appropriate contact.
To Reproduce
Steps to reproduce the behavior:
Create a Pagerduty escalation policy similar to the following
Attempt to report an incident. The incident will not be created. Check the logs and you will see:
ERROR:No users could be found for this pagerduty escalation policy (*snip1*). Is there a schedule associated?:/usr/local/lib/python3.8/site-packages/dispatch/incident/views.py:create_incident:112
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/dispatch/incident/views.py", line 110, in create_incident
incident = create(db_session=db_session, **incident_in.dict())
File "/usr/local/lib/python3.8/site-packages/dispatch/incident/service.py", line 228, in create
assign_incident_role(
File "/usr/local/lib/python3.8/site-packages/dispatch/incident/service.py", line 44, in assign_incident_role
assignee_email = oncall_plugin.instance.get(service_id=service.external_id)
File "/usr/local/lib/python3.8/site-packages/dispatch/decorators.py", line 106, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/dispatch/decorators.py", line 122, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/dispatch/plugins/dispatch_pagerduty/plugin.py", line 33, in get
return get_oncall(client=client, service_id=service_id)
File "/usr/local/lib/python3.8/site-packages/dispatch/plugins/dispatch_pagerduty/service.py", line 35, in get_oncall
return get_oncall_email(client, service)
File "/usr/local/lib/python3.8/site-packages/dispatch/plugins/dispatch_pagerduty/service.py", line 24, in get_oncall_email
raise Exception(
Exception: No users could be found for this pagerduty escalation policy (*snip1*). Is there a schedule associated?
INFO: 10.84.80.225:39996 - "POST /api/v1/default/incidents HTTP/1.1" 400 Bad Request
Expected behavior get_oncall_email() should be aware of the possibility of an escalation policy entry that contains a user instead of a schedule. The exception message implies that a schedule is the only valid input in this spot, but that's not true.
Additional context
Running dispatch version from PR #1493 @ymatsiuk is under the red box in the screenshot
The text was updated successfully, but these errors were encountered:
As a quick workaround we can introduce conditional here to check for escalation_policy["escalation_rules"][0]["targets"][0]["type"] and if user_reference than replace this with user_ids[]
Describe the bug
If a pagerduty escalation policy entry does not contain a schedule, Dispatch fails to find the appropriate contact.
To Reproduce

Steps to reproduce the behavior:
Create a Pagerduty escalation policy similar to the following
Attempt to report an incident. The incident will not be created. Check the logs and you will see:
Expected behavior
get_oncall_email() should be aware of the possibility of an escalation policy entry that contains a user instead of a schedule. The exception message implies that a schedule is the only valid input in this spot, but that's not true.
Additional context
Running dispatch version from PR #1493
@ymatsiuk is under the red box in the screenshot
The text was updated successfully, but these errors were encountered: