1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

InternetService#disable_monitor and #enable_ping_monitor

This commit is contained in:
freeformz 2011-02-15 05:42:51 +08:00 committed by Wesley Beary
parent be273b74cf
commit c937fe3566

View file

@ -35,6 +35,22 @@ module Fog
end
end
# disables monitoring for this service
def disable_monitor
if self.monitor and self.monitor[:type] == "Disabled"
raise RuntimeError.new("Monitoring already disabled")
else
self.monitor = {:type => "Disabled", :is_enabled => "true"}
self.save
end
end
# enable default ping monitoring, use monitor= for more exotic forms (ECV & HTTP)
def enable_ping_monitor
self.monitor = nil
self.save
end
def monitor=(new_monitor = {})
if new_monitor.nil? || new_monitor.empty?
attributes[:monitor] = nil