Sha256: 637297ad17c4b483010f89de5d8d247bcdefceb30bcfa12d17ff5bd7680039b8

Contents?: true

Size: 1.83 KB

Versions: 8

Compression:

Stored size: 1.83 KB

Contents

module Rubyipmi::Freeipmi

  class BmcInfo < Rubyipmi::Freeipmi::BaseCommand

    def initialize(opts = ObservableHash.new)
      super("bmc-info", opts)

    end


    def guid
      @options["guid"] = false
      status = runcmd
      @options.delete_notify["guid"]
      if not status
        raise @result
      else
        @result.chomp.strip
      end

    end
    # freeipmi
    # Device ID:         17
    # Device Revision:   1
    #                    [SDR Support]
    # Firmware Revision: 2.09
    #                    [Device Available (normal operation)]
    # IPMI Version:      2.0
    # Additional Device Support:
    #                    [Sensor Device]
    #                    [SDR Repository Device]
    #                    [SEL Device]
    #                    [FRU Inventory Device]
    # Manufacturer ID:   11
    # Product ID:        8192
    # Channel Information:
    #        Channel No: 2
    #       Medium Type: 802.3 LAN
    #     Protocol Type: IPMB-1.0
    #        Channel No: 7
    #       Medium Type: OEM
    #     Protocol Type: KCS
    def retrieve
      bmcinfo = {}
      status = runcmd
      subkey = nil
      if not status
        raise @result
      else
        @result.lines.each do |line|
          # clean up the data from spaces
          item = line.split(':')
          key = item.first.strip
          value = item.last.strip
          # if the following condition is met we have subvalues
          if key == value and not subkey
            subkey = key
            bmcinfo[subkey] = []
          elsif key == value and subkey
            # subvalue found
            bmcinfo[subkey] << value.gsub(/\[|\]/, "")
          else
            # Normal key/value pair with no subkeys
            subkey = nil
            bmcinfo[key] = value
          end
        end
        return bmcinfo
      end
    end


  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubyipmi-0.6.0 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.5.1 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.5.0 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.4.0 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.3.3 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.3.2 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.3.1 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.3.0 lib/rubyipmi/freeipmi/commands/bmcinfo.rb