Class: Rubyipmi::Ipmitool::Chassis
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- BaseCommand
- Rubyipmi::Ipmitool::Chassis
- Defined in:
- lib/rubyipmi/ipmitool/commands/chassis.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
#cmd, #lastcall, #max_retry_count, #options, #passfile, #result
Instance Method Summary collapse
-
#bootbios(reboot = false, persistent = false) ⇒ Object
boot into bios setup with option to reboot.
-
#bootcdrom(reboot = false, persistent = false) ⇒ Object
set boot device to cdrom with option to reboot.
-
#bootdevice(device, reboot = false, persistent = false) ⇒ Object
set boot device from given boot device.
-
#bootdisk(reboot = false, persistent = false) ⇒ Object
set boot device to disk with option to reboot.
-
#bootpxe(reboot = false, persistent = false) ⇒ Object
set boot device to pxe with option to reboot.
-
#config ⇒ Object
Access to the config command created on the fly.
-
#identify(status = false, delay = 0) ⇒ Object
Turn the led light on / off or with a delay status means to enable or disable the blinking.
-
#identifystatus ⇒ Object
A currently unsupported method to retrieve the led status.
-
#initialize(opts = ObservableHash.new) ⇒ Chassis
constructor
A new instance of Chassis.
-
#power ⇒ Object
Access to the power command created on the fly.
- #status ⇒ Object
Methods inherited from BaseCommand
#find_fix, #makecommand, #max_retry_count, #setpass
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) ⇒ Chassis
Returns a new instance of Chassis.
3 4 5 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 3 def initialize(opts = ObservableHash.new) super("ipmitool", opts) end |
Instance Method Details
#bootbios(reboot = false, persistent = false) ⇒ Object
boot into bios setup with option to reboot
72 73 74 75 76 77 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 72 def bootbios(reboot = false, persistent = false) bootstatus = config.bootbios(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus bootstatus end |
#bootcdrom(reboot = false, persistent = false) ⇒ Object
set boot device to cdrom with option to reboot
64 65 66 67 68 69 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 64 def bootcdrom(reboot = false, persistent = false) bootstatus = config.bootcdrom(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus bootstatus end |
#bootdevice(device, reboot = false, persistent = false) ⇒ Object
set boot device from given boot device
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 36 def bootdevice(device, reboot = false, persistent = false) if config.bootdevices.include?(device) bootstatus = config.bootdevice(device, persistent) power.cycle if reboot && status else logger.debug("Device with name: #{device} is not a valid boot device for host #{['hostname']}") if logger raise "Device with name: #{device} is not a valid boot device for host #{['hostname']}" end bootstatus end |
#bootdisk(reboot = false, persistent = false) ⇒ Object
set boot device to disk with option to reboot
56 57 58 59 60 61 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 56 def bootdisk(reboot = false, persistent = false) bootstatus = config.bootdisk(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus bootstatus end |
#bootpxe(reboot = false, persistent = false) ⇒ Object
set boot device to pxe with option to reboot
48 49 50 51 52 53 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 48 def bootpxe(reboot = false, persistent = false) bootstatus = config.bootpxe(persistent) # Only reboot if setting the boot flag was successful power.cycle if reboot && bootstatus bootstatus end |
#config ⇒ Object
Access to the config command created on the fly
31 32 33 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 31 def config @config ||= Rubyipmi::Ipmitool::ChassisConfig.new(@options) end |
#identify(status = false, delay = 0) ⇒ Object
Turn the led light on / off or with a delay status means to enable or disable the blinking
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 9 def identify(status = false, delay = 0) if status if !delay.between?(1, 255) ["cmdargs"] = "chassis identify 255" else ["cmdargs"] = "chassis identify #{delay}" end else ["cmdargs"] = "chassis identify 0" end # Run the command value = runcmd .delete_notify("cmdargs") value end |
#identifystatus ⇒ Object
A currently unsupported method to retrieve the led status
87 88 89 90 91 92 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 87 def identifystatus ["cmdargs"] = "chassis identify status" value = runcmd .delete_notify("cmdargs") @result.chomp.split(":").last.strip if value end |
#power ⇒ Object
Access to the power command created on the fly
26 27 28 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 26 def power @power ||= Rubyipmi::Ipmitool::Power.new(@options) end |
#status ⇒ Object
79 80 81 82 83 84 |
# File 'lib/rubyipmi/ipmitool/commands/chassis.rb', line 79 def status ["cmdargs"] = "chassis status" value = runcmd .delete_notify("cmdargs") {:result => @result, :value => value} end |