class Rubyipmi::Freeipmi::ChassisConfig

Public Class Methods

new(opts = ObservableHash.new) click to toggle source
Calls superclass method Rubyipmi::BaseCommand::new
# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 3
def initialize(opts = ObservableHash.new)
  super("ipmi-chassis-config", opts)
end

Public Instance Methods

bootbios(persistent = true) click to toggle source

shortcut to boot into bios setup

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 66
def bootbios(persistent = true)
  bootdevice("BIOS-SETUP", persistent)
end
bootcdrom(persistent = true) click to toggle source

shortcut to set boot device to cdrom

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 61
def bootcdrom(persistent = true)
  bootdevice("CD-DVD", persistent)
end
bootdevice(device, persistent) click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 26
def bootdevice(device, persistent)
  set_boot_flag("Boot_Device", device, persistent)
end
bootdevices() click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 30
def bootdevices
  # freeipmi returns a list of supported devices
  # However, for now we will just assume the following
  ["PXE", "HARD-DRIVE", "CD-DVD", "BIOS-SETUP"]
  # TODO: return array of possible boot devices
end
bootdisk(persistent = true) click to toggle source

shortcut to set boot device to disk

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 56
def bootdisk(persistent = true)
  bootdevice("HARD-DRIVE", persistent)
end
bootpersistent(value) click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 37
def bootpersistent(value)
  # TODO: find out if we can specify multiple key-pair values
  if value == true
    flag = "Chassis_Boot_Flags:Boot_Flags_Persistent=Yes"
  else
    flag = "Chassis_Boot_Flags:Boot_Flags_Persistent=No"
  end
  @options["key-pair"] = "\"#{flag}\""
  value = commit
  @options.delete_notify("key-pair")
  value
end
bootpxe(persistent = true) click to toggle source

shortcut to set boot device to pxe

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 51
def bootpxe(persistent = true)
  bootdevice("PXE", persistent)
end
checkout(section = nil) click to toggle source

This is the raw command to get the entire ipmi chassis configuration If you pass in a section you will get just the section

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 17
def checkout(section = nil)
  @options["checkout"] = false
  @options["section"] = section if section
  value = runcmd
  @options.delete_notify("checkout")
  @options.delete_notify("section") if section
  value
end
commit() click to toggle source

This is the raw command to send a new configuration to the ipmi device

# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 8
def commit
  @options["commit"] = false
  value = runcmd
  @options.delete_notify("commit")
  value
end

Private Instance Methods

set_boot_flag(key, flag, _persistent) click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassisconfig.rb, line 72
def set_boot_flag(key, flag, _persistent)
  @options["key-pair"] = "\"Chassis_Boot_Flags:#{key}=#{flag}\""
  value = commit
  @options.delete_notify("key-pair")
  value
end