Sha256: 6fa34e9fcdd646e204def8bd008b67ad280138c04582a258d9d2dd831a382f85
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 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', '') return "#{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) if 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubyipmi-0.8.1 | lib/rubyipmi/ipmitool/commands/basecommand.rb |
rubyipmi-0.7.0 | lib/rubyipmi/ipmitool/commands/basecommand.rb |