Sha256: 400f8eb8be342277c226f2995276a27f666e4570bfa20cfdfe0f65de8d851c7b

Contents?: true

Size: 1.16 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

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