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 =
3
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.
- #restart ⇒ Object
- #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
#restart ⇒ Object
24 25 26 27 28 29 |
# 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 ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# 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 |