Class: Flydata::Helper::Action::AgentAction

Inherits:
BaseAction
  • Object
show all
Defined in:
lib/flydata/helper/action/agent_action.rb

Direct Known Subclasses

RestartAgent, StopAgent

Constant Summary collapse

FLYDATA_CMD =
"flydata %{command}"

Instance Attribute Summary

Attributes inherited from BaseAction

#config

Instance Method Summary collapse

Methods inherited from BaseAction

#get_service, #initialize

Constructor Details

This class inherits a constructor from Flydata::Helper::BaseAction

Instance Method Details

#execute(opts = {}) ⇒ Object


10
11
12
13
14
15
16
# File 'lib/flydata/helper/action/agent_action.rb', line 10

def execute(opts = {})
  cmd = FLYDATA_CMD % { command: command }
  log_debug("Executing #{cmd}")
  o, e, s = Util::Shell.run_cmd(cmd)
  log_error(e) if not e.to_s.empty?
  log.error("Could not execute #{cmd}. Response status : #{s}") unless (s.to_i == 0)
end