Class: Dopi::Command::Custom

Instance Attribute Summary

Attributes inherited from Dopi::Command

#hash, #is_verify_command, #node

Instance Method Summary collapse

Methods included from Dopi::CommandParser::Output

#check_output, #error_patterns, #fail_on_warning, #lines_with_matches, #parse_output, #validate_output, #warning_patterns

Methods included from Dopi::CommandParser::ExitCode

#check_exit_code, #expect_exit_codes, #validate_exit_code

Methods included from Dopi::CommandParser::Arguments

#arguments, #validate_arguments

Methods included from Dopi::CommandParser::Env

#env, #validate_env

Methods included from Dopi::CommandParser::Exec

#exec, #validate_exec

Methods included from Dopi::Connector::Local

#local_command

Methods inherited from Dopi::Command

create_plugin_instance, delete_plugin_default, delete_plugin_defaults, inherited, #initialize, #load_state, #merged_hash, #meta_run, #meta_valid?, plugin_defaults, set_plugin_defaults, #state_hash, wipe_plugin_defaults

Methods included from State

#delete_on_signal, #on_signal, #reset_signals, #send_signal, #signal_procs, #signals, #state, #state_add_child, #state_auto_evaluate_children, #state_auto_evaluate_children=, #state_changed, #state_children, #state_children_done?, #state_children_failed?, #state_children_partial?, #state_children_ready?, #state_children_running?, #state_children_running_noop?, #state_children_starting?, #state_done?, #state_fail, #state_failed?, #state_finish, #state_partial?, #state_ready, #state_ready?, #state_reset, #state_reset_with_children, #state_run, #state_run_noop, #state_running?, #state_running_noop?, #state_start, #state_starting?, #to_yaml_properties, #update, #update_mutex

Constructor Details

This class inherits a constructor from Dopi::Command

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/dopi/command/custom.rb', line 28

def run
  result = []
  cmd_stdout, cmd_stderr, cmd_exit_code = local_command(env, command_string)
  # Output Parser
  result << check_output(cmd_stdout)
  result << check_output(cmd_stderr)
  # Exit Code Parser
  result << check_exit_code(cmd_exit_code)
  result.all?
end

#run_noopObject



39
40
41
42
# File 'lib/dopi/command/custom.rb', line 39

def run_noop
  log(:info, "(NOOP) Executing '#{command_string}' for command #{name}")
  log(:info, "(NOOP) Environment: #{env.to_s}")
end

#validateObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dopi/command/custom.rb', line 16

def validate
  #validate_exec
  # remove after the refactoring is complete
  unless Dopi::Command::Custom > self.class && self.method(:exec).owner == self.class
    log_validation_method('exec_valid?', CommandParsingError)
  end
  validate_env
  validate_arguments
  validate_exit_code
  validate_output
end