Class: PowerManager

Inherits:
Object
  • Object
show all
Defined in:
app/models/power_manager.rb

Direct Known Subclasses

BMCPowerManager, VirtPowerManager

Constant Summary collapse

SUPPORTED_ACTIONS =
[N_('start'), N_('stop'), N_('poweroff'), N_('reboot'), N_('reset'), N_('state')]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ PowerManager

Returns a new instance of PowerManager.


4
5
6
# File 'app/models/power_manager.rb', line 4

def initialize(opts = {})
  @host = opts[:host]
end

Class Method Details

.method_missing(method, *args) ⇒ Object


8
9
10
11
# File 'app/models/power_manager.rb', line 8

def self.method_missing(method, *args)
  logger.warn "invalid power state request #{action} for host: #{host}"
  raise ::Foreman::Exception.new(N_("Invalid power state request: %{action}, supported actions are %{supported}"), { :action => action, :supported => SUPPORTED_ACTIONS })
end

Instance Method Details

#loggerObject


17
18
19
# File 'app/models/power_manager.rb', line 17

def logger
  Rails.logger
end

#stateObject


13
14
15
# File 'app/models/power_manager.rb', line 13

def state
  N_("Unknown")
end