Class: Rubyipmi::Freeipmi::Power
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- BaseCommand
- Rubyipmi::Freeipmi::Power
- Includes:
- PowerMixin
- Defined in:
- lib/rubyipmi/freeipmi/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, #validate_status
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/freeipmi/commands/power.rb', line 7 def initialize(opts = ObservableHash.new) super("ipmipower", 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/freeipmi/commands/power.rb', line 12 def command(opt) @options[opt] = false runcmd @options.delete_notify(opt) @result end |
#power_interrupt ⇒ Object
19 20 21 |
# File 'lib/rubyipmi/freeipmi/commands/power.rb', line 19 def power_interrupt command("pulse") end |
#status ⇒ Object
Get the power status of the system, will show either on or off
24 25 26 27 |
# File 'lib/rubyipmi/freeipmi/commands/power.rb', line 24 def status value = command("stat") @result.split(":").last.chomp.strip if value end |