Class: Rubyipmi::Ipmitool::ErrorCodes
- Inherits:
-
Object
- Object
- Rubyipmi::Ipmitool::ErrorCodes
- 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"} }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.code ⇒ Object
16 17 18 |
# File 'lib/rubyipmi/ipmitool/errorcodes.rb', line 16 def self.code @@codes end |
.length ⇒ Object
12 13 14 |
# File 'lib/rubyipmi/ipmitool/errorcodes.rb', line 12 def self.length @@codes.length end |
.search(code) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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}.*/i return result end end else return fix end raise "No Fix found" if fix.nil? end |
Instance Method Details
#throwError ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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 |