Class: Wakame::Command::Actor

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

Constant Summary

Constants included from Service

Service::Property, Service::STATUS_ENTERING, Service::STATUS_FAIL, Service::STATUS_INIT, Service::STATUS_MIGRATING, Service::STATUS_OFFLINE, Service::STATUS_ONLINE, Service::STATUS_QUITTING, Service::STATUS_RELOADING, Service::STATUS_RUNNING, Service::STATUS_STARTING, Service::STATUS_STOPPING, Service::STATUS_TERMINATE, Service::STATUS_UNKNOWN

Instance Method Summary collapse

Methods included from Wakame::Command

included, #options=, #params

Instance Method Details

#runObject



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

def run
  agent = Agent.find(params['agent_id'])
  raise "Unknown agent: #{params['agent_id']}" if agent.nil?
  raise "Invalid agent status (Not Online): #{agent.status} #{params['agent_id']}" if agent.status != Agent::STATUS_ONLINE
  raise "Invalid actor path: #{params['path']}" if params['path'].nil? || params['path'] == ''
  if params['args'].is_a? String
    params['args'] = eval(params['args'])
  end

  request = master.actor_request(params['agent_id'], params['path'], *params['args']).request
end