Class: Rubyipmi::Freeipmi::Chassis
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- BaseCommand
- Rubyipmi::Freeipmi::Chassis
- Defined in:
- lib/rubyipmi/freeipmi/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.
-
#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, #validate_status
Methods inherited from BaseCommand
#dump_command, #find_fix, #locate_command, #makecommand, #removepass, #run, #runcmd, #setpass, #update, #validate_status
Constructor Details
#initialize(opts = ObservableHash.new) ⇒ Chassis
Returns a new instance of Chassis.
5 6 7 8 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 5 def initialize(opts = ObservableHash.new) super("ipmi-chassis", opts) end |
Instance Method Details
#bootbios(reboot = false, persistent = false) ⇒ Object
boot into bios setup with option to reboot
79 80 81 82 83 84 85 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 79 def bootbios(reboot=false,persistent=false) bootstatus = config.bootbios(persistent) # Only reboot if setting the boot flag was successful if reboot and bootstatus power.cycle end end |
#bootcdrom(reboot = false, persistent = false) ⇒ Object
set boot device to cdrom with option to reboot
70 71 72 73 74 75 76 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 70 def bootcdrom(reboot=false,persistent=false) bootstatus = config.bootcdrom(persistent) # Only reboot if setting the boot flag was successful if reboot and bootstatus power.cycle end end |
#bootdevice(device, reboot = false, persistent = false) ⇒ Object
set boot device from given boot device
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 38 def bootdevice(device, reboot=false, persistent=false) if config.bootdevices.include?(device) bootstatus = config.bootdevice(device, persistent) if reboot and bootstatus power.cycle end else raise "Device with name: #{device} is not a valid boot device for host #{["hostname"]}" end end |
#bootdisk(reboot = false, persistent = false) ⇒ Object
set boot device to disk with option to reboot
60 61 62 63 64 65 66 67 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 60 def bootdisk(reboot=false,persistent=false) bootstatus = config.bootdisk(persistent) # Only reboot if setting the boot flag was successful if reboot and bootstatus power.cycle end end |
#bootpxe(reboot = false, persistent = false) ⇒ Object
set boot device to pxe with option to reboot
51 52 53 54 55 56 57 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 51 def bootpxe(reboot=false,persistent=false) bootstatus = config.bootpxe(persistent) # Only reboot if setting the boot flag was successful if reboot and bootstatus power.cycle end end |
#config ⇒ Object
Access to the config command created on the fly
33 34 35 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 33 def config @config ||= Rubyipmi::Freeipmi::ChassisConfig.new(@options) end |
#identify(status = false, delay = 0) ⇒ Object
Turn the led light on / off or with a delay
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 11 def identify(status=false, delay=0) if status if delay <= 0 ["chassis-identify"] = "FORCE" else ["chassis-identify"] = delay end else ["chassis-identify"] = "TURN-OFF" end # Run the command value = runcmd .delete_notify("chassis-identify") return value end |
#identifystatus ⇒ Object
A currently unsupported method to retrieve the led status
100 101 102 103 104 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 100 def identifystatus # TODO implement this function # parse out the identify status # status.result end |
#power ⇒ Object
Access to the power command created on the fly
28 29 30 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 28 def power @power ||= Rubyipmi::Freeipmi::Power.new(@options) end |
#status ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/rubyipmi/freeipmi/commands/chassis.rb', line 87 def status ["get-status"] = false value = runcmd .delete_notify("get-status") if value return parsestatus else return value end end |