Fix SetOneTimeBoot to use standard ComputerSystem 'Boot' property (#54201)

* fix SetOneTimeBoot to use standard ComputerSystem 'Boot' property

* add support for UefiTarget and UefiBootNext boot sources
This commit is contained in:
Bill Dodd 2019-05-02 07:50:41 -05:00 committed by John R Barker
parent eb7190264e
commit 2614e823df
2 changed files with 97 additions and 15 deletions

View file

@ -74,6 +74,16 @@ options:
default: 10
type: int
version_added: '2.8'
uefi_target:
required: false
description:
- UEFI target when bootdevice is "UefiTarget"
version_added: "2.9"
boot_next:
required: false
description:
- BootNext target when bootdevice is "UefiBootNext"
version_added: "2.9"
author: "Jose Delarosa (@jose-delarosa)"
'''
@ -96,6 +106,26 @@ EXAMPLES = '''
username: "{{ username }}"
password: "{{ password }}"
- name: Set one-time boot device to UefiTarget of "/0x31/0x33/0x01/0x01"
redfish_command:
category: Systems
command: SetOneTimeBoot
bootdevice: "UefiTarget"
uefi_target: "/0x31/0x33/0x01/0x01"
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Set one-time boot device to BootNext target of "Boot0001"
redfish_command:
category: Systems
command: SetOneTimeBoot
bootdevice: "UefiBootNext"
boot_next: "Boot0001"
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Set chassis indicator LED to blink
redfish_command:
category: Chassis
@ -183,7 +213,9 @@ def main():
new_password=dict(no_log=True),
roleid=dict(),
bootdevice=dict(),
timeout=dict(type='int', default=10)
timeout=dict(type='int', default=10),
uefi_target=dict(),
boot_next=dict()
),
supports_check_mode=False
)
@ -248,7 +280,10 @@ def main():
if "Power" in command:
result = rf_utils.manage_system_power(command)
elif command == "SetOneTimeBoot":
result = rf_utils.set_one_time_boot_device(module.params['bootdevice'])
result = rf_utils.set_one_time_boot_device(
module.params['bootdevice'],
module.params['uefi_target'],
module.params['boot_next'])
elif category == "Chassis":
result = rf_utils._find_chassis_resource(rf_uri)
@ -283,7 +318,8 @@ def main():
# Return data back or fail with proper message
if result['ret'] is True:
del result['ret']
module.exit_json(changed=True, msg='Action was successful')
changed = result.get('changed', True)
module.exit_json(changed=changed, msg='Action was successful')
else:
module.fail_json(msg=to_native(result['msg']))