1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Redfish: Do not set the boot source override mode if not provided by the user (#3581)

* Redfish: Do not set the boot source override mode if not provided by the user

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Corrected changelog file extension

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Update changelogs/fragments/3509-redfish_utils-SetOneTimeBoot-mode-fix.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Mike Raineri 2021-10-22 01:29:26 -04:00 committed by GitHub
parent e7e2ab94da
commit 481fc48e51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- redfish_utils module utils - do not attempt to change the boot source override mode if not specified by the user (https://github.com/ansible-collections/community.general/issues/3509/).

View file

@ -1605,9 +1605,6 @@ class RedfishUtils(object):
cur_boot_next = boot.get('BootNext') cur_boot_next = boot.get('BootNext')
cur_override_mode = boot.get('BootSourceOverrideMode') cur_override_mode = boot.get('BootSourceOverrideMode')
if not boot_override_mode:
boot_override_mode = cur_override_mode
if override_enabled == 'Disabled': if override_enabled == 'Disabled':
payload = { payload = {
'Boot': { 'Boot': {
@ -1643,16 +1640,18 @@ class RedfishUtils(object):
} }
} }
else: else:
if cur_enabled == override_enabled and target == bootdevice and cur_override_mode == boot_override_mode: if (cur_enabled == override_enabled and target == bootdevice and
(cur_override_mode == boot_override_mode or not boot_override_mode)):
# If properties are already set, no changes needed # If properties are already set, no changes needed
return {'ret': True, 'changed': False} return {'ret': True, 'changed': False}
payload = { payload = {
'Boot': { 'Boot': {
'BootSourceOverrideEnabled': override_enabled, 'BootSourceOverrideEnabled': override_enabled,
'BootSourceOverrideMode': boot_override_mode,
'BootSourceOverrideTarget': bootdevice 'BootSourceOverrideTarget': bootdevice
} }
} }
if boot_override_mode:
payload['Boot']['BootSourceOverrideMode'] = boot_override_mode
response = self.patch_request(self.root_uri + self.systems_uri, payload) response = self.patch_request(self.root_uri + self.systems_uri, payload)
if response['ret'] is False: if response['ret'] is False: