class ForemanMaintain::Check

Attributes

associated_feature[RW]

Public Instance Methods

__run__(execution) click to toggle source

internal method called by executor

Calls superclass method
# File lib/foreman_maintain/check.rb, line 39
def __run__(execution)
  super
rescue Error::Fail => e
  set_fail(e.message)
rescue Error::Warn => e
  set_warn(e.message)
end
assert(condition, error_message, options = {}) click to toggle source

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
# File lib/foreman_maintain/check.rb, line 20
def assert(condition, error_message, options = {})
  options = options.validate_options!(:next_steps, :warn)
  unless condition
    next_steps = Array(options.fetch(:next_steps, []))
    self.next_steps.concat(next_steps)
    if options[:warn]
      warn!(error_message)
    else
      fail!(error_message)
    end
  end
end
run() click to toggle source

public method to be overriden

# File lib/foreman_maintain/check.rb, line 34
def run
  raise NotImplementedError
end