Class: Rubyipmi::Ipmitool::ErrorCodes

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyipmi/ipmitool/errorcodes.rb

Constant Summary collapse

CODES =
{
  "Authentication type NONE not supported\nAuthentication type NONE not supported\n" \
  "Error: Unable to establish LAN session\nGet Device ID command failed\n" => {"I" => "lanplus"},
  "Authentication type NONE not supported" => {"I" => "lanplus"},
  "Error: Unable to establish LAN session\nGet Device ID command failed\n" => {"I" => "lanplus"}
}

Class Method Summary collapse

Class Method Details

.codeObject



15
16
17
# File 'lib/rubyipmi/ipmitool/errorcodes.rb', line 15

def self.code
  CODES
end

.lengthObject



11
12
13
# File 'lib/rubyipmi/ipmitool/errorcodes.rb', line 11

def self.length
  CODES.length
end

.search(code) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubyipmi/ipmitool/errorcodes.rb', line 19

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
      return result if code =~ /.*#{error}.*/i
    end
  else
    return fix
  end
  raise "No Fix found" if fix.nil?
end