Sha256: 803db90f9c9552b32c613eaee0e601c5429590d4c15a29094b8d87a8275b79c2
Contents?: true
Size: 1.57 KB
Versions: 5
Compression:
Stored size: 1.57 KB
Contents
module Rubyipmi module Ipmitool class ErrorCodes @@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"} } def self.length @@codes.length end def self.code @@codes end 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}.*/i return result end end else return fix end raise "No Fix found" if fix.nil? end 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 end end end
Version data entries
5 entries across 5 versions & 1 rubygems