Class: Wakame::Command::ShutdownVm

Inherits:
Object
  • Object
show all
Includes:
Wakame::Command
Defined in:
lib/wakame/command/shutdown_vm.rb

Instance Method Summary collapse

Methods included from Wakame::Command

included, #options=, #params

Instance Method Details

#run(rule) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wakame/command/shutdown_vm.rb', line 7

def run(rule)
  registered_agents = rule.agent_monitor.registered_agents[@options["agent_id"]]
  if !registered_agents.services.nil?
    if !@options["force"].nil?
      registered_agents.services.each{|id, svc_inst|
 rule.trigger_action(Wakame::Actions::StopService.new(svc_inst))
	}
    else
      raise "Service instances Launched"
    end
  end
  rule.trigger_action(Wakame::Actions::ShutdownVM.new(registered_agents))
end