Sha256: 8032a1bdd4ce751cb0b3a88a02d4431cba12b0c3c850e7d371543ab727e3db3e
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module Rubyipmi::Freeipmi class Fru < Rubyipmi::Freeipmi::BaseCommand def initialize(opts = ObservableHash.new) super("ipmi-fru", opts) end # return the list of fru information in a hash def list @list ||= parse(command) end def serial list["chassis_serial_number"] end def manufacturer list["board_manufacturer"] end def product list["board_product_name"] end private def method_missing(method, *args, &block) if not list.has_key?(method.to_s) raise NoMethodError else list[method.to_s] end end # parse the fru information def parse(data) datalist = {} data.lines.each do |line| key, value = line.split(':') next if key =~ /\n/ value = value.strip key = key.gsub(/FRU/, '').strip.gsub(/\ /, '_').downcase datalist[key] = value.strip end return datalist end # run the command and return result def command value = runcmd if value return @result end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubyipmi-0.6.0 | lib/rubyipmi/freeipmi/commands/fru.rb |
rubyipmi-0.5.1 | lib/rubyipmi/freeipmi/commands/fru.rb |
rubyipmi-0.5.0 | lib/rubyipmi/freeipmi/commands/fru.rb |