Sha256: 5d74136123ac1c338f2b98cc3312d531b491e13dc38e8db47f509a9baec01831

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module Rubyipmi::Freeipmi

  class BmcInfo < Rubyipmi::Freeipmi::BaseCommand

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

    end


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

    end

    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

2 entries across 2 versions & 1 rubygems

Version Path
rubyipmi-0.8.1 lib/rubyipmi/freeipmi/commands/bmcinfo.rb
rubyipmi-0.7.0 lib/rubyipmi/freeipmi/commands/bmcinfo.rb