diff --git a/changelogs/fragments/3006-redfish_command-bootoverride-argument-check.yaml b/changelogs/fragments/3006-redfish_command-bootoverride-argument-check.yaml new file mode 100644 index 0000000000..680d3dea83 --- /dev/null +++ b/changelogs/fragments/3006-redfish_command-bootoverride-argument-check.yaml @@ -0,0 +1,3 @@ +bugfixes: + - redfish_command - fix extraneous error caused by missing ``bootdevice`` argument + when using the ``DisableBootOverride`` sub-command (https://github.com/ansible-collections/community.general/issues/3005). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index c39c02a42e..8d293f0056 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1582,13 +1582,14 @@ class RedfishUtils(object): boot = data[key] - annotation = 'BootSourceOverrideTarget@Redfish.AllowableValues' - if annotation in boot: - allowable_values = boot[annotation] - if isinstance(allowable_values, list) and bootdevice not in allowable_values: - return {'ret': False, - 'msg': "Boot device %s not in list of allowable values (%s)" % - (bootdevice, allowable_values)} + if override_enabled != 'Disabled': + annotation = 'BootSourceOverrideTarget@Redfish.AllowableValues' + if annotation in boot: + allowable_values = boot[annotation] + if isinstance(allowable_values, list) and bootdevice not in allowable_values: + return {'ret': False, + 'msg': "Boot device %s not in list of allowable values (%s)" % + (bootdevice, allowable_values)} # read existing values cur_enabled = boot.get('BootSourceOverrideEnabled')