Class: Wakame::Command::MigrateService

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

Instance Method Summary collapse

Methods included from Wakame::Command

included, #options=, #params

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/wakame/command/migrate_service.rb', line 5

def run
  svc = nil
  svc = service_cluster.find_service(options["service_id"])
  if svc.nil?
    raise "Unknown Service ID: #{options["service_id"]}" 
  end

  # Optional destination agent 
  agent = nil
  if options["agent_id"]
    agent = master.agent_monitor.agent_pool.find_agent(options["agent_id"])
    if agent.nil?
      raise "Unknown Agent ID: #{options["agent_id"]}" 
    end
  end

  trigger_action(Wakame::Actions::MigrateService.new(svc, agent))
end