class Proxy::DHCP::Infoblox::GridRestart
Constants
- MAX_ATTEMPTS
Attributes
connection[R]
Public Class Methods
new(connection)
click to toggle source
# File lib/smart_proxy_dhcp_infoblox/grid_restart.rb, line 8 def initialize(connection) @connection = connection end
Public Instance Methods
try_restart()
click to toggle source
# File lib/smart_proxy_dhcp_infoblox/grid_restart.rb, line 12 def try_restart logger.info 'Restarting Infoblox Grid' delay = Proxy::DHCP::Infoblox::Plugin.settings.wait_after_restart.to_i MAX_ATTEMPTS.times do |tries| if restart if delay > 0 logger.info "Starting post-restart delay of #{delay} seconds..." sleep delay logger.debug "Post-restart delay done" end return end sleep tries end logger.warn 'Restarting Infoblox Grid failed, giving up' false end
Private Instance Methods
restart()
click to toggle source
# File lib/smart_proxy_dhcp_infoblox/grid_restart.rb, line 34 def restart (@grid ||= ::Infoblox::Grid.get(@connection).first).restartservices true rescue Exception => e logger.warn "Error during Grid restart: #{e}" false end