Class: Rubyipmi::Freeipmi::ErrorCodes
- Inherits:
-
Object
- Object
- Rubyipmi::Freeipmi::ErrorCodes
- Defined in:
- lib/rubyipmi/freeipmi/errorcodes.rb
Constant Summary collapse
- CODES =
{ "authentication type unavailable for attempted privilege level" => {"driver-type" => "LAN_2_0"}, "authentication type unavailable for attempted privilege level\n" => {"driver-type" => "LAN_2_0"} }
Class Method Summary collapse
Class Method Details
.code ⇒ Object
12 13 14 |
# File 'lib/rubyipmi/freeipmi/errorcodes.rb', line 12 def self.code CODES end |
.length ⇒ Object
8 9 10 |
# File 'lib/rubyipmi/freeipmi/errorcodes.rb', line 8 def self.length CODES.length end |
.search(code) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubyipmi/freeipmi/errorcodes.rb', line 16 def self.search(code) # example error code: # "/usr/local/sbin/bmc-info: authentication type unavailable for attempted privilege level\n" code.chomp! # clean up newline code = code.split(':').last.strip # clean up left hand side and strip white space from sides fix = CODES.fetch(code, nil) if fix.nil? CODES.each do |error, result| fix = result if code =~ /.*#{error}.*/i end end raise "No Fix found" if fix.nil? fix end |