Class: Rubyipmi::Ipmitool::Power
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- BaseCommand
- Rubyipmi::Ipmitool::Power
- Includes:
- PowerMixin
- Defined in:
- lib/rubyipmi/ipmitool/commands/power.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
#cmd, #lastcall, #max_retry_count, #options, #passfile, #result
Instance Method Summary collapse
-
#command(opt) ⇒ Object
The command function is a wrapper that actually calls the run method.
-
#initialize(opts = ObservableHash.new) ⇒ Power
constructor
A new instance of Power.
- #power_interrupt ⇒ Object
-
#status ⇒ Object
Get the power status of the system, will show either on or off.
Methods included from PowerMixin
#cycle, #off, #off?, #on, #on?, #powerInterrupt, #reset, #softShutdown, #soft_shutdown
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) ⇒ Power
Returns a new instance of Power.
7 8 9 |
# File 'lib/rubyipmi/ipmitool/commands/power.rb', line 7 def initialize(opts = ObservableHash.new) super("ipmitool", opts) end |
Instance Method Details
#command(opt) ⇒ Object
The command function is a wrapper that actually calls the run method
12 13 14 15 16 17 |
# File 'lib/rubyipmi/ipmitool/commands/power.rb', line 12 def command(opt) @options["cmdargs"] = "power #{opt}" value = runcmd @options.delete_notify("cmdargs") value end |
#power_interrupt ⇒ Object
19 20 21 |
# File 'lib/rubyipmi/ipmitool/commands/power.rb', line 19 def power_interrupt command("diag") end |
#status ⇒ Object
Get the power status of the system, will show either on or off
24 25 26 27 |
# File 'lib/rubyipmi/ipmitool/commands/power.rb', line 24 def status value = command("status") @result.match(/(off|on)/).to_s if value end |