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

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

Direct Known Subclasses

Clear, Repair, RestartAgent, Resync, StopAgent

Constant Summary collapse

FLYDATA_CMD =
"#{Flydata::FLYDATA_CMD_PATH} %{sub_command}"

Instance Attribute Summary

Attributes inherited from BaseAction

#config

Instance Method Summary collapse

Methods inherited from BaseAction

#config_hash, #initialize

Constructor Details

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

Instance Method Details

#execute(opts = {}) ⇒ Object



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

def execute(opts = {})
  sub_command = command(opts)
  cmd = FLYDATA_CMD % { sub_command: sub_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