Sha256: c0a1c7b6a09f0601b8175e093e62ac46e250f142d0527017d90808684b4f5de6

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

module Rubyipmi::Freeipmi

  class ErrorCodes

    @@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"},

    }

    def self.length
      @@codes.length
    end

    def self.code
       @@codes
    end

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

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyipmi-0.8.1 lib/rubyipmi/freeipmi/errorcodes.rb
rubyipmi-0.7.0 lib/rubyipmi/freeipmi/errorcodes.rb