redfish_command: allow setting the BootSourceOverrideMode property (#3135) (#3147)

* For #3134

Expose BootOverrideMode parameter to redfish_command to allow setting by user during run.

* Fix trailing whitespace

* Add changelog fragment to contribution.

* Update changelogs/fragments/3135-add-redfish_command-bootoverridemode.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/remote_management/redfish/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/remote_management/redfish/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/remote_management/redfish/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/remote_management/redfish/redfish_command.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/3135-add-redfish_command-bootoverridemode.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 75688cb632)

Co-authored-by: Scott Seekamp <sylgeist@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-08-04 20:07:24 +02:00 committed by GitHub
parent 6d147d748f
commit f915cf5df2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View file

@ -1565,6 +1565,7 @@ class RedfishUtils(object):
uefi_target = boot_opts.get('uefi_target')
boot_next = boot_opts.get('boot_next')
override_enabled = boot_opts.get('override_enabled')
boot_override_mode = boot_opts.get('boot_override_mode')
if not bootdevice and override_enabled != 'Disabled':
return {'ret': False,
@ -1596,6 +1597,10 @@ class RedfishUtils(object):
target = boot.get('BootSourceOverrideTarget')
cur_uefi_target = boot.get('UefiTargetBootSourceOverride')
cur_boot_next = boot.get('BootNext')
cur_override_mode = boot.get('BootSourceOverrideMode')
if not boot_override_mode:
boot_override_mode = cur_override_mode
if override_enabled == 'Disabled':
payload = {
@ -1632,12 +1637,13 @@ class RedfishUtils(object):
}
}
else:
if cur_enabled == override_enabled and target == bootdevice:
if cur_enabled == override_enabled and target == bootdevice and cur_override_mode == boot_override_mode:
# If properties are already set, no changes needed
return {'ret': True, 'changed': False}
payload = {
'Boot': {
'BootSourceOverrideEnabled': override_enabled,
'BootSourceOverrideMode': boot_override_mode,
'BootSourceOverrideTarget': bootdevice
}
}