Class: Nucleon::Action::Agent::Manager
- Inherits:
-
Object
- Object
- Nucleon::Action::Agent::Manager
- Defined in:
- lib/nucleon/action/agent/manager.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
-
#arguments ⇒ Object
—.
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/agent/manager.rb', line 10 def self.describe super(nil, :manager, 1100) end |
Instance Method Details
#arguments ⇒ Object
29 30 31 |
# File 'lib/nucleon/action/agent/manager.rb', line 29 def arguments [ :sleep_interval ] end |
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 24 25 |
# File 'lib/nucleon/action/agent/manager.rb', line 17 def configure super do codes :network_failure register_int :sleep_interval, 15 register_int :network_retries, 3 register_int :agent_restart_retries, 2 end end |
#execute ⇒ Object
Operations
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/nucleon/action/agent/manager.rb', line 36 def execute super do |node| ensure_node(node) do network_retry = 0 agent_restart_retry = {} while status == code.success if network.load({ :remote => settings[:net_remote], :pull => true }) network_retry = 0 node.agents.each do |provider, | agent_restart_retry[provider] = 0 unless agent_restart_retry.has_key?(provider) unless provider == :agent_manager || node.agent_running(provider) if agent_restart_retry[provider] < settings[:agent_restart_retries] command = "corl #{[:args]} --log_level=warn" result = node.exec({ :commands => [ command ] }).first if result.status == code.success agent_restart_retry[provider] = 0 else agent_restart_retry[provider] += 1 end end end end elsif network_retry < settings[:network_retries] network_retry += 1 else myself.status = code.network_failure end sleep settings[:sleep_interval] end end end end |