Class: ForemanMaintain::Check
- Inherits:
-
Executable
- Object
- Executable
- ForemanMaintain::Check
- Includes:
- ForemanMaintain::Concerns::Finders, ForemanMaintain::Concerns::Logger, ForemanMaintain::Concerns::Metadata, ForemanMaintain::Concerns::SystemHelpers
- Defined in:
- lib/foreman_maintain/check.rb
Constant Summary
Constants included from ForemanMaintain::Concerns::Metadata
ForemanMaintain::Concerns::Metadata::MAX_PREPARATION_STEPS_DEPTH
Instance Attribute Summary collapse
-
#associated_feature ⇒ Object
Returns the value of attribute associated_feature.
Attributes inherited from Executable
Instance Method Summary collapse
-
#__run__(execution) ⇒ Object
internal method called by executor.
-
#assert(condition, error_message, options = {}) ⇒ Object
run condition and mark the check as failed when not passing.
-
#run ⇒ Object
public method to be overriden.
Methods included from ForemanMaintain::Concerns::Finders
#check, #detector, #feature, #find_all_scenarios, #find_checks, #find_procedures, #find_scenarios, #procedure
Methods included from ForemanMaintain::Concerns::Metadata
#advanced_run?, #description, included, #label, #label_dashed, #metadata, #params, #preparation_steps, #run_once?, #runtime_message, #tags
Methods included from ForemanMaintain::Concerns::SystemHelpers
#check_max_version, #check_min_version, #command_present?, #create_lv_snapshot, #directory_empty?, #execute, #execute!, #execute?, #execute_runner, #execute_with_status, #file_exists?, #file_nonzero?, #find_dir_containing_file, #find_package, #find_symlinks, #format_shell_args, #get_lv_info, #get_lv_path, #hostname, included, #package_manager, #package_version, #packages_action, #parse_csv, #parse_json, #rpm_version, #server?, #shellescape, #systemd_installed?, #version
Methods included from ForemanMaintain::Concerns::Logger
Methods inherited from Executable
#abort!, #after_initialize, ensure_instance, #ensure_instance, #eql?, #executed?, #execution, #fail!, #hash, #initialize, #inspect, #matches_hash?, #necessary?, #next_steps, #say, #set_abort, #set_fail, #set_param_variable, #set_skip, #set_status, #set_warn, #setup_execution_state, #setup_params, #skip, #to_hash, #update_from_hash, #warn!
Constructor Details
This class inherits a constructor from ForemanMaintain::Executable
Instance Attribute Details
#associated_feature ⇒ Object
Returns the value of attribute associated_feature.
8 9 10 |
# File 'lib/foreman_maintain/check.rb', line 8 def associated_feature @associated_feature end |
Instance Method Details
#__run__(execution) ⇒ Object
internal method called by executor
39 40 41 42 43 44 45 |
# File 'lib/foreman_maintain/check.rb', line 39 def __run__(execution) super rescue Error::Fail => e set_fail(e.) rescue Error::Warn => e set_warn(e.) end |
#assert(condition, error_message, options = {}) ⇒ Object
run condition and mark the check as failed when not passing
Options
-
+:next_steps* - one or more procedures that can be followed to address
the failure, will be offered to the user when running in interactive mode
-
+:warn* - issue warning instead of failure: this is less strict check,
that could be considered as non-critical for continuing with the scenario
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/foreman_maintain/check.rb', line 20 def assert(condition, , = {}) = .(:next_steps, :warn) unless condition next_steps = Array(.fetch(:next_steps, [])) self.next_steps.concat(next_steps) if [:warn] warn!() else fail!() end end end |
#run ⇒ Object
public method to be overriden
34 35 36 |
# File 'lib/foreman_maintain/check.rb', line 34 def run raise NotImplementedError end |