Class: Rubyipmi::Freeipmi::BmcDevice

Inherits:
BaseCommand show all
Defined in:
lib/rubyipmi/freeipmi/commands/bmcdevice.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#cmd, #lastcall, #max_retry_count, #options, #passfile, #result

Instance Method Summary collapse

Methods inherited from BaseCommand

#find_fix, #makecommand, #max_retry_count, #setpass, #validate_status

Methods inherited from BaseCommand

#dump_command, #find_fix, #locate_command, #logger, #makecommand, #removepass, #run, #runcmd, #setpass, #update, #validate_status

Constructor Details

#initialize(opts = ObservableHash.new) ⇒ BmcDevice

Returns a new instance of BmcDevice.



3
4
5
# File 'lib/rubyipmi/freeipmi/commands/bmcdevice.rb', line 3

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

Instance Method Details

#command(opt) ⇒ Object

runs a command like bmc-device –cold-reset



8
9
10
11
12
13
# File 'lib/rubyipmi/freeipmi/commands/bmcdevice.rb', line 8

def command(opt)
  @options[opt] = false
  value = runcmd
  @options.delete_notify(opt)
  value
end

#reset(type = 'cold') ⇒ Object

reset the bmc device, useful for debugging and troubleshooting



16
17
18
19
20
21
22
23
24
# File 'lib/rubyipmi/freeipmi/commands/bmcdevice.rb', line 16

def reset(type = 'cold')
  if ['cold', 'warm'].include?(type)
    key = "#{type}-reset"
    command(key)
  else
    logger.error("reset type: #{type} is not a valid choice, use warm or cold") if logger
    raise "reset type: #{type} is not a valid choice, use warm or cold"
  end
end