Skip to content

Commit

Permalink
Check for valid context in _priority_verify
Browse files Browse the repository at this point in the history
  • Loading branch information
javier_marcos committed Nov 28, 2017
1 parent 2a454e5 commit 6099948
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions stream_alert/alert_processor/outputs/pagerduty.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ def _priority_verify(self, context):
dict: JSON object be used in the API call, containing the priority id
and the priority reference, empty if it fails or it does not exist
"""
if not context:
return dict()

priority_name = context.get('incident_priority', False)
if not priority_name:
return dict()
Expand Down Expand Up @@ -442,9 +445,7 @@ def dispatch(self, **kwargs):
rule_context = rule_context.get(self.__service__, {})

# Use the priority provided in the context, use it or the incident will be low priority
incident_priority = {}
if rule_context:
incident_priority = self._priority_verify(rule_context)
incident_priority = self._priority_verify(rule_context)

# Incident assignment goes in this order:
# Provided user -> provided policy -> default policy
Expand Down

0 comments on commit 6099948

Please sign in to comment.