Class: RightScale::InstanceCommands
- Defined in:
- lib/instance/instance_commands.rb
Overview
Commands exposed by instance agent To add a new command, simply add it to the COMMANDS hash and define its implementation in a method called ‘<command name>_command’
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', :run_recipe => 'Run recipe with id given in options[:id] and optionally JSON given in options[:json]', :run_right_script => 'Run RightScript with id given in options[:id] and arguments given in hash options[:arguments] (e.g. { \'application\' => \'text:Mephisto\' })', :send_push => 'Send request to one or more remote agents with no response expected', :send_persistent_push => 'Send request to one or more remote agents with no response expected with persistence en route', :send_retryable_request => 'Send request to a remote agent with a response expected and retry if response times out', :send_persistent_request => 'Send request to a remote agent with a response expected with persistence ' + 'en route and no retries that would result in it being duplicated', :send_idempotent_request => 'Send a request to a remote agent (identified solely by operation), retrying at the' + 'application level until the request succeeds or the timeout elapses', :set_log_level => 'Set log level to options[:level]', :get_log_level => 'Get log level', :decommission => 'Run instance decommission bundle synchronously', :terminate => 'Terminate agent', :get_tags => 'Retrieve instance tags', :add_tag => 'Add given tag', :remove_tag => 'Remove given tag', :query_tags => 'Query for instances with specified tags', :audit_create_entry => 'Create a new audit entry', :audit_update_status => 'Update last audit title', :audit_create_new_section => 'Create new audit section', :audit_append_output => 'Append process output to audit', :audit_append_info => 'Append info message to audit', :audit_append_error => 'Append error message to audit', :set_inputs_patch => 'Set inputs patch post execution', :check_connectivity => 'Check whether the instance is able to communicate', :close_connection => 'Close persistent connection (used for auditing)', :stats => 'Get statistics about instance agent operation', :get_shutdown_request => 'Gets the requested reboot state.', :set_shutdown_request => 'Sets the requested reboot state.' }
Class Method Summary collapse
-
.get(agent_identity, scheduler, agent_manager) ⇒ Object
Build hash of commands associating command names with block.
Instance Method Summary collapse
-
#initialize(agent_identity, scheduler, agent_manager) ⇒ InstanceCommands
constructor
Set token id used to send core requests.
Constructor Details
#initialize(agent_identity, scheduler, agent_manager) ⇒ InstanceCommands
Set token id used to send core requests
Parameter
- agent_identity(String)
-
Serialized instance agent identity
- scheduler(InstanceScheduler)
-
Scheduler used by decommission command
- agent_manager(AgentManager)
-
Agent manager used by stats command
88 89 90 91 92 93 |
# File 'lib/instance/instance_commands.rb', line 88 def initialize(agent_identity, scheduler, agent_manager) @agent_identity = agent_identity @scheduler = scheduler @serializer = Serializer.new @agent_manager = agent_manager end |
Class Method Details
.get(agent_identity, scheduler, agent_manager) ⇒ Object
Build hash of commands associating command names with block
Parameters
- agent_identity(String)
-
Serialized instance agent identity
- scheduler(InstanceScheduler)
-
Scheduler used by decommission command
- agent_manager(AgentManager)
-
Agent manager used by stats command
Return
- cmds(Hash)
-
Hash of command blocks keyed by command names
75 76 77 78 79 80 |
# File 'lib/instance/instance_commands.rb', line 75 def self.get(agent_identity, scheduler, agent_manager) cmds = {} target = new(agent_identity, scheduler, agent_manager) COMMANDS.each { |k, _| cmds[k] = lambda { |opts, conn| opts[:conn] = conn; target.send("#{k.to_s}_command", opts) } } cmds end |