Sha256: 177ee53a434b7b2a967e7a793e8816db7d391e3dce4e3b609258b9a33f47658c
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require 'rubyipmi/ipmitool/errorcodes' module Rubyipmi::Ipmitool class BaseCommand < Rubyipmi::BaseCommand def setpass super @options["f"] = @passfile.path @passfile.write "#{@options['P']}" @passfile.rewind @passfile.close end def max_retry_count @max_retry_count ||= Rubyipmi::Ipmitool::ErrorCodes.length end 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 # 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 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubyipmi-0.11.1 | lib/rubyipmi/ipmitool/commands/basecommand.rb |
rubyipmi-0.11.0 | lib/rubyipmi/ipmitool/commands/basecommand.rb |