Module: ILO_SDK::ComputerSystemHelper

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

Overview

Contains helper methods for Computer System actions

Instance Method Summary collapse

Instance Method Details

#get_asset_tagString

Deprecated.

Use #get_system_settings instead

Get the Asset Tag

Returns:

  • (String)

    asset_tag

Raises:

  • (RuntimeError)

    if the request failed



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

def get_asset_tag
  @logger.warn '[Deprecated] `get_asset_tag` is deprecated. Please use `get_system_settings[\'AssetTag\']` instead.'
  response = rest_get('/redfish/v1/Systems/1/')
  response_handler(response)['AssetTag']
end

#get_indicator_ledString

Deprecated.

Use #get_system_settings instead

Get the UID indicator LED state

Returns:

  • (String)

    indicator_led

Raises:

  • (RuntimeError)

    if the request failed



60
61
62
63
64
# File 'lib/ilo-sdk/helpers/computer_system_helper.rb', line 60

def get_indicator_led
  @logger.warn '[Deprecated] `get_indicator_led` is deprecated. Please use `get_system_settings[\'IndicatorLED\']` instead.'
  response = rest_get('/redfish/v1/Systems/1/')
  response_handler(response)['IndicatorLED']
end

#get_system_settings(system_id = 1) ⇒ Hash

Get the computer system settings

Parameters:

  • system_id (Integer, String) (defaults to: 1)

    ID of the system

Returns:

  • (Hash)

    Computer system settings

Raises:

  • (RuntimeError)

    if the request failed



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

def get_system_settings(system_id = 1)
  response_handler(rest_get("/redfish/v1/Systems/#{system_id}/"))
end

#set_asset_tag(asset_tag) ⇒ Object

Deprecated.

Use #set_system_settings instead

Set the Asset Tag

Parameters:

  • asset_tag (String, Symbol)

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



48
49
50
51
52
53
54
# File 'lib/ilo-sdk/helpers/computer_system_helper.rb', line 48

def set_asset_tag(asset_tag)
  @logger.warn '[Deprecated] `set_asset_tag` is deprecated. Please use `set_system_settings(AssetTag: <tag>)` instead.'
  new_action = { 'AssetTag' => asset_tag }
  response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
  response_handler(response)
  true
end

#set_indicator_led(state) ⇒ Object

Deprecated.

Use #set_system_settings instead

Set the UID indicator LED

Parameters:

  • state (String, Symbol)

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



71
72
73
74
75
76
77
# File 'lib/ilo-sdk/helpers/computer_system_helper.rb', line 71

def set_indicator_led(state)
  @logger.warn '[Deprecated] `set_indicator_led` is deprecated. Please use `set_system_settings(IndicatorLED: <state>)` instead.'
  new_action = { 'IndicatorLED' => state }
  response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
  response_handler(response)
  true
end

#set_system_settings(options, system_id = 1) ⇒ Object

Set computer system settings

Parameters:

  • options (Hash)

    Hash of options to set

  • system_id (Integer, String) (defaults to: 1)

    ID of the system

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



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

def set_system_settings(options, system_id = 1)
  response_handler(rest_patch("/redfish/v1/Systems/#{system_id}/", body: options))
  true
end