Class: RightScale::AgentManagerCommands
- Defined in:
- lib/right_agent/command/agent_manager_commands.rb
Overview
Commands exposed by agent that has an AgentManager actor
Constant Summary collapse
- COMMANDS =
List of command names associated with description The commands should be implemented in methods in this class named ‘<name>_command’ where <name> is the name of the command.
{ :list => 'List all available commands with their description', :set_log_level => 'Set log level to options[:level]', :get_log_level => 'Get log level', :ping => 'Ping agent', :stats => 'Get statistics about agent operation', :profile => 'Manage memory profiling', :terminate => 'Terminate agent' }
Class Method Summary collapse
-
.get(agent_manager) ⇒ Object
Build hash of commands associating command names with block.
Instance Method Summary collapse
-
#initialize(agent_manager) ⇒ AgentManagerCommands
constructor
Initialize command server.
Constructor Details
#initialize(agent_manager) ⇒ AgentManagerCommands
Initialize command server
Parameter
- agent_manager(AgentManager)
-
Agent manager used by ping and stats commands
59 60 61 62 |
# File 'lib/right_agent/command/agent_manager_commands.rb', line 59 def initialize(agent_manager) @agent_manager = agent_manager @serializer = Serializer.new end |
Class Method Details
.get(agent_manager) ⇒ Object
Build hash of commands associating command names with block
Parameter
- agent_manager(AgentManager)
-
Agent manager used by ping and stats commands
Return
- cmds(Hash)
-
Hash of command blocks keyed by command names
48 49 50 51 52 53 |
# File 'lib/right_agent/command/agent_manager_commands.rb', line 48 def self.get(agent_manager) cmds = {} target = new(agent_manager) COMMANDS.each { |k, v| cmds[k] = lambda { |opts, conn| opts[:conn] = conn; target.send("#{k.to_s}_command", opts) } } cmds end |