Parent

Rubyipmi::Ipmitool::ErrorCodes

Public Class Methods

code() click to toggle source
# File lib/rubyipmi/ipmitool/errorcodes.rb, line 16
def self.code
  @@codes
end
length() click to toggle source
# File lib/rubyipmi/ipmitool/errorcodes.rb, line 12
def self.length
  @@codes.length
end
search(code) click to toggle source
# File lib/rubyipmi/ipmitool/errorcodes.rb, line 20
def self.search(code)
  fix = @@codes.fetch(code,nil)
  if fix.nil?
    @@codes.each do | error, result |
      # the error should be a subset of the actual erorr
      if code =~ /.*#{error}.*/
        return result
      end
    end
  else
    return fix
  end
  raise "No Fix found" if fix.nil?
end

Public Instance Methods

throwError() click to toggle source
# File lib/rubyipmi/ipmitool/errorcodes.rb, line 36
def throwError
  # Find out what kind of error is happening, parse results
  # Check for authentication or connection issue

  if @result =~ /timeout|timed\ out/
    code = "ipmi call: #{@lastcall} timed out"
    raise code
  else
    code = @result.split(":").last.chomp.strip if not @result.empty?
  end
  case code
    when "invalid hostname"
      raise code
    when "password invalid"
      raise code
    when "username invalid"
      raise code
    else
      raise :ipmierror, code
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.