Sha256: 445c01228c2e5ebd0b9fc354f0c5d6d16b90c0dac776781118424a2977a1c566
Contents?: true
Size: 1.14 KB
Versions: 13
Compression:
Stored size: 1.14 KB
Contents
require 'flydata/helper/base_action' require 'flydata/util/shell' module Flydata module Helper module Action class AgentAction < BaseAction FLYDATA_CMD = "#{Flydata::FLYDATA_CMD_PATH} %{sub_command}" def execute(opts = {}) sub_command = command(opts) cmd = FLYDATA_CMD % { sub_command: sub_command } log_info("Executing `#{cmd}`") o, e, s = Util::Shell.run_cmd(cmd) log_warn(e) if not e.to_s.empty? log_error("[error] Could not execute #{cmd}. Response status: #{s}") unless (s.to_i == 0) end # Override this. Needs to be implemented by the subclass #def command(opts = {}) #end def get_tables(opts) tables = config_hash(opts)[:tables] tables_str = case tables when Array tables.join(' ') when String # --all option tables else raise "Wrong tables parameter - tables:\"#{tables}\"" end tables_str end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems