class Rubyipmi::Freeipmi::Chassis
Public Class Methods
new(opts = ObservableHash.new)
click to toggle source
Calls superclass method
Rubyipmi::BaseCommand::new
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 3 def initialize(opts = ObservableHash.new) super("ipmi-chassis", opts) end
Public Instance Methods
bootbios(reboot = false, persistent = false)
click to toggle source
boot into bios setup with option to reboot
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 67 def bootbios(reboot = false, persistent = false) bootstatus = config.bootbios(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus end
bootcdrom(reboot = false, persistent = false)
click to toggle source
set boot device to cdrom with option to reboot
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 60 def bootcdrom(reboot = false, persistent = false) bootstatus = config.bootcdrom(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus end
bootdevice(device, reboot = false, persistent = false)
click to toggle source
set boot device from given boot device
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 35 def bootdevice(device, reboot = false, persistent = false) if config.bootdevices.include?(device) bootstatus = config.bootdevice(device, persistent) power.cycle if reboot && bootstatus else logger.error("Device with name: #{device} is not a valid boot device for host #{options['hostname']}") if logger raise "Device with name: #{device} is not a valid boot device for host #{options['hostname']}" end end
bootdisk(reboot = false, persistent = false)
click to toggle source
set boot device to disk with option to reboot
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 53 def bootdisk(reboot = false, persistent = false) bootstatus = config.bootdisk(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus end
bootpxe(reboot = false, persistent = false)
click to toggle source
set boot device to pxe with option to reboot
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 46 def bootpxe(reboot = false, persistent = false) bootstatus = config.bootpxe(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus end
config()
click to toggle source
Access to the config command created on the fly
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 30 def config @config ||= Rubyipmi::Freeipmi::ChassisConfig.new(@options) end
identify(status = false, delay = 0)
click to toggle source
Turn the led light on / off or with a delay
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 8 def identify(status = false, delay = 0) if status if delay <= 0 options["chassis-identify"] = "FORCE" else options["chassis-identify"] = delay end else options["chassis-identify"] = "TURN-OFF" end # Run the command value = runcmd options.delete_notify("chassis-identify") value end
identifystatus()
click to toggle source
A currently unsupported method to retrieve the led status
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 85 def identifystatus # TODO: implement this function # parse out the identify status # status.result end
power()
click to toggle source
Access to the power command created on the fly
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 25 def power @power ||= Rubyipmi::Freeipmi::Power.new(@options) end
status()
click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 73 def status options["get-status"] = false value = runcmd options.delete_notify("get-status") if value return parsestatus else return value end end
Private Instance Methods
parsestatus()
click to toggle source
# File lib/rubyipmi/freeipmi/commands/chassis.rb, line 93 def parsestatus statusresult = @result statusvalues = {} statusresult.lines.each do |line| # clean up the data from spaces item = line.split(':') key = item.first.strip value = item.last.strip statusvalues[key] = value end statusvalues end