class Rubyipmi::Ipmitool::BaseCommand

Public Instance Methods

find_fix(result) click to toggle source

The findfix method acts like a recursive method and applies fixes defined in the errorcodes If a fix is found it is applied to the options hash, and then the last run command is retried until all the fixes are exhausted or a error not defined in the errorcodes is found

# File lib/rubyipmi/ipmitool/commands/basecommand.rb, line 36
def find_fix(result)
  return unless result
  # The errorcode code hash contains the fix
  begin
    fix = ErrorCodes.search(result)
    @options.merge_notify!(fix)

  rescue
    raise "Could not find fix for error code: \n#{result}"
  end
end
makecommand() click to toggle source
# File lib/rubyipmi/ipmitool/commands/basecommand.rb, line 17
def makecommand
  args = ''
  # need to format the options to ipmitool format
  @options.each do |k, v|
    # must remove from command line as its handled via conf file
    next if k == "P"
    next if k == "cmdargs"
    args << " -#{k} #{v}"
  end

  # since ipmitool requires commands to be in specific order
  args << ' ' + options.fetch('cmdargs', '')

  "#{cmd} #{args.lstrip}"
end
max_retry_count() click to toggle source
# File lib/rubyipmi/ipmitool/commands/basecommand.rb, line 13
def max_retry_count
  @max_retry_count ||= Rubyipmi::Ipmitool::ErrorCodes.length
end
setpass() click to toggle source
Calls superclass method Rubyipmi::BaseCommand#setpass
# File lib/rubyipmi/ipmitool/commands/basecommand.rb, line 5
def setpass
  super
  @options["f"] = @passfile.path
  @passfile.write "#{@options['P']}"
  @passfile.rewind
  @passfile.close
end