Skip to content

Commit

Permalink
Move the check for configuration existence into the method, so that t…
Browse files Browse the repository at this point in the history
…he code

reads more consistently with other similar use cases.
  • Loading branch information
TJ Saunders committed Jan 21, 2018
1 parent db014e0 commit 84dd393
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/handler-opsgenie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def create_alert
teams: json_config['teams'])
end

def priority
def event_priority
return nil unless json_config['priority']
priority = json_config['priority']

canonical_priority = priority.upcase
Expand Down Expand Up @@ -148,7 +149,8 @@ def post_to_opsgenie(action = :create, params = {})
params['source'] = json_config['source'] if json_config['source']

# Override priority, if specified.
params['priority'] = priority if json_config['priority']
priority = event_priority
params['priority'] = priority if priority

encoded_alias = URI.escape(params[:alias])
# TODO: come back and asses if this logic is correct, I left it functionally
Expand Down

0 comments on commit 84dd393

Please sign in to comment.