Class: Wakame::Actions::RegisterAgent
- Inherits:
-
Wakame::Action
- Object
- Wakame::Action
- Wakame::Actions::RegisterAgent
- Defined in:
- lib/wakame/actions/register_agent.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Attribute Summary
Attributes inherited from Wakame::Action
Instance Method Summary collapse
-
#initialize(agent) ⇒ RegisterAgent
constructor
A new instance of RegisterAgent.
- #on_fail ⇒ Object
- #run ⇒ Object
Methods inherited from Wakame::Action
#acquire_lock, #actor_request, #agent_monitor, #all_subactions_complete?, #flush_subactions, #master, #notes, #notify, #on_canceled, #on_failed, #service_cluster, #status=, #subactions, #sync_actor_request, #trigger_action, #walk_subactions
Methods included from ThreadImmutable
#bind_thread, included, #target_thread, #target_thread?, #thread_check
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Constructor Details
#initialize(agent) ⇒ RegisterAgent
Returns a new instance of RegisterAgent.
4 5 6 |
# File 'lib/wakame/actions/register_agent.rb', line 4 def initialize(agent) @agent = agent end |
Instance Method Details
#on_fail ⇒ Object
35 36 37 38 39 |
# File 'lib/wakame/actions/register_agent.rb', line 35 def on_fail StatusDB. { @agent.update_status(Service::Agent::STATUS_FAIL) } end |
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wakame/actions/register_agent.rb', line 8 def run Wakame.log.debug("#{self.class}: run() begin: #{@agent.id}") acquire_lock("Agent:#{@agent.id}") StatusDB. { @agent.update_vm_attr } # Send monitoring conf if @agent.cloud_host_id Wakame.log.debug("#{self.class}: #{@agent.id} is to be set the monitor conf: #{@agent.cloud_host.live_monitors.inspect}") StatusDB. { @agent.cloud_host.live_monitors.each { |path, data| master.actor_request(@agent.id, '/monitor/reload', path, data).request.wait } } end StatusDB. { @agent.update_status(Service::Agent::STATUS_RUNNING) @agent.update_monitor_status(Service::Agent::STATUS_ONLINE) Models::AgentPool.instance.register(@agent) } Wakame.log.debug("#{self.class}: run() end: #{@agent.id}") end |