Module: ILO_SDK::BootSettingsHelper

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

Overview

Contains helper methods for Boot Settings actions

Instance Method Summary collapse

Instance Method Details

#get_boot_baseconfigFixnum

Get the boot base config

Returns:

  • (Fixnum)

    boot_baseconfig

Raises:

  • (RuntimeError)

    if the request failed



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

def get_boot_baseconfig
  response = rest_get('/redfish/v1/Systems/1/bios/Boot/Settings/')
  response_handler(response)['BaseConfig']
end

#get_boot_orderFixnum

Get the boot order

Returns:

  • (Fixnum)

    boot_order

Raises:

  • (RuntimeError)

    if the request failed



36
37
38
39
# File 'lib/ilo-sdk/helpers/boot_settings_helper.rb', line 36

def get_boot_order
  response = rest_get('/redfish/v1/systems/1/bios/Boot/Settings/')
  response_handler(response)['PersistentBootConfigOrder']
end

#get_temporary_boot_orderFixnum

Get the temporary boot order

Returns:

  • (Fixnum)

    temporary_boot_order

Raises:

  • (RuntimeError)

    if the request failed



55
56
57
58
# File 'lib/ilo-sdk/helpers/boot_settings_helper.rb', line 55

def get_temporary_boot_order
  response = rest_get('/redfish/v1/Systems/1/')
  response_handler(response)['Boot']['BootSourceOverrideTarget']
end

#revert_bootObject

Revert the boot

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



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

def revert_boot
  new_action = { 'BaseConfig' => 'default' }
  response = rest_patch('/redfish/v1/systems/1/bios/Boot/Settings/', body: new_action)
  response_handler(response)
  true
end

#set_boot_order(boot_order) ⇒ Object

Set the boot order

Parameters:

  • boot_order (Fixnum)

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



45
46
47
48
49
50
# File 'lib/ilo-sdk/helpers/boot_settings_helper.rb', line 45

def set_boot_order(boot_order)
  new_action = { 'PersistentBootConfigOrder' => boot_order }
  response = rest_patch('/redfish/v1/systems/1/bios/Boot/Settings/', body: new_action)
  response_handler(response)
  true
end

#set_temporary_boot_order(boot_target) ⇒ Object

Set the temporary boot order

Parameters:

  • boot_target (Fixnum)

Returns:

  • true

Raises:

  • (RuntimeError)

    if the request failed



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ilo-sdk/helpers/boot_settings_helper.rb', line 64

def set_temporary_boot_order(boot_target)
  response = rest_get('/redfish/v1/Systems/1/')
  boottargets = response_handler(response)['Boot']['BootSourceOverrideSupported']
  unless boottargets.include? boot_target
    raise "BootSourceOverrideTarget value - #{boot_target} is not supported. Valid values are: #{boottargets}"
  end
  new_action = { 'Boot' => { 'BootSourceOverrideTarget' => boot_target } }
  response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
  response_handler(response)
  true
end