Sha256: d56db71eed9c0b2f09093ddcdc0281b93c9fb9b62fd512dd7ec1fd6f83754376

Contents?: true

Size: 936 Bytes

Versions: 5

Compression:

Stored size: 936 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

5 entries across 5 versions & 1 rubygems

Version Path
rubyipmi-0.10.0 lib/rubyipmi/freeipmi/errorcodes.rb
rubyipmi-0.9.3 lib/rubyipmi/freeipmi/errorcodes.rb
rubyipmi-0.9.2 lib/rubyipmi/freeipmi/errorcodes.rb
rubyipmi-0.9.1 lib/rubyipmi/freeipmi/errorcodes.rb
rubyipmi-0.9.0 lib/rubyipmi/freeipmi/errorcodes.rb