Class: Proxy::DHCP::Infoblox::GridRestart
- Inherits:
-
Object
- Object
- Proxy::DHCP::Infoblox::GridRestart
- Includes:
- Log
- Defined in:
- lib/smart_proxy_dhcp_infoblox/grid_restart.rb
Constant Summary collapse
- MAX_ATTEMPTS =
5
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(connection) ⇒ GridRestart
constructor
A new instance of GridRestart.
- #try_restart ⇒ Object
Constructor Details
#initialize(connection) ⇒ GridRestart
Returns a new instance of GridRestart.
8 9 10 |
# File 'lib/smart_proxy_dhcp_infoblox/grid_restart.rb', line 8 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/smart_proxy_dhcp_infoblox/grid_restart.rb', line 6 def connection @connection end |
Instance Method Details
#try_restart ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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 |