Skip to content

Commit

Permalink
ensure monitoring manager deletion and creation on provider update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari Zellner committed Dec 14, 2017
1 parent 1bfd713 commit 84505b7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/models/mixins/has_monitoring_manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ module HasMonitoringManagerMixin

def ensure_monitoring_manager
# monitoring_manager should be defined by child classes.
if try(:monitoring_manager_needed?)
if monitoring_manager_needed? && monitoring_manager.nil?
build_monitoring_manager(:parent_manager => self)
monitoring_manager.name = "#{name} Monitoring Manager"
end
ensure_monitoring_manager_properties
end

def ensure_monitoring_manager_properties
if monitoring_manager
monitoring_manager.zone_id = zone_id
monitoring_manager.provider_region = provider_region
elsif !monitoring_manager_needed? && monitoring_manager.present?
# TODO:: if someone deletes the alerts endpoint and then quickly readds it they can end up without a manager.
monitoring_manager.delete_queue
end
end
end

0 comments on commit 84505b7

Please sign in to comment.