Module: ILO_SDK::PowerHelper

Included in:
Client
Defined in:
lib/ilo-sdk/helpers/power_helper.rb

Overview

Contains helper methods for Power actions

Instance Method Summary collapse

Instance Method Details

#get_power_stateString

Get the Power State

Returns:

  • (String)

    power_state

Raises:

  • (RuntimeError)

    if the request failed


18
19
20
21
# File 'lib/ilo-sdk/helpers/power_helper.rb', line 18

def get_power_state
  response = rest_get('/redfish/v1/Systems/1/')
  response_handler(response)['PowerState']
end

#reset_iloObject

Reset the iLO

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed


37
38
39
40
41
42
# File 'lib/ilo-sdk/helpers/power_helper.rb', line 37

def reset_ilo
  new_action = { 'Action' => 'Reset' }
  response = rest_post('/redfish/v1/Managers/1/', body: new_action)
  response_handler(response)
  true
end

#set_power_state(state) ⇒ Object

Set the Power State

Parameters:

  • state (String, Symbol)

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed


27
28
29
30
31
32
# File 'lib/ilo-sdk/helpers/power_helper.rb', line 27

def set_power_state(state)
  new_action = { 'Action' => 'Reset', 'ResetType' => state }
  response = rest_post('/redfish/v1/Systems/1/', body: new_action)
  response_handler(response)
  true
end