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

restart() click to toggle source
# File lib/smart_proxy_dhcp_infoblox/grid_restart.rb, line 24
def restart
  (@grid ||= ::Infoblox::Grid.get(@connection).first).restartservices
  true
rescue Exception => e
  false
end
try_restart() click to toggle source
# File lib/smart_proxy_dhcp_infoblox/grid_restart.rb, line 12
def try_restart
  logger.debug 'Restarting grid.'

  MAX_ATTEMPTS.times do |tries|
    sleep tries
    return if restart
  end

  logger.info 'Restarting Grid failed.'
  false
end