Repository: ansible-collections/community.general

Issue:
BootOverride feature behaves incorrectly
### Summary

When disabling the boot override mode this module fails if the boot device is not specified even though that is not used or needed for that functionality.

This was an oversight when I proposed PR #825


### Issue Type

Bug Report

### Component Name

redfish_utils.py

### Ansible Version

```
ansible 2.10.7
  config file = /home/sylgeist/firmware_updater/ansible.cfg
  configured module search path = ['/home/sylgeist/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/sylgeist/.local/share/virtualenvs/test-xtrMZVtF/lib/python3.6/site-packages/ansible
  executable location = /home/sylgeist/.local/share/virtualenvs/test-xtrMZVtF/bin/ansible
  python version = 3.6.9 (default, Oct  8 2020, 12:12:24) [GCC 8.4.0]
```

### Configuration

_No response_

### OS / Environment

Ubuntu 18.04

### Steps to Reproduce

Running a task to disable the redfish boot override fails if boot device isn't specified:

```
    - name: Disable persistent boot device override
      community.general.redfish_command:
        category: Systems
        command: DisableBootOverride
        baseuri: "{{ address }}"
        username: "{{ username }}"
        password: "{{ password }}"
```


### Expected Results

It should disable the continuous boot override property:

"BootSourceOverrideEnabled": "Disabled"

### Actual Results

```
TASK [Disable persistent boot device override] ***************************************************************************************************************************
Tuesday 13 July 2021  14:27:15 -0400 (0:00:00.109)       0:00:09.692 ********** 
fatal: [s2r5node64]: FAILED! => {"changed": false, "msg": "Boot device None not in list of allowable values ([u'None', u'Pxe', u'Floppy', u'Cd', u'Hdd', u'BiosSetup', u'Utilities', u'UefiTarget', u'SDCard', u'UefiHttp'])"}
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
The disable argument is getting caught by:
https://github.com/ansible-collections/community.general/blob/3fc97bf80aae8c695288e8920df3ea48b151a369/plugins/module_utils/redfish_utils.py#L1588

which requires a boot device argument even though it has no requirement or effect when just disabling the override.
cc @mraineri @renxulei @tomasg2012 @xmadsen
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py
--- a/plugins/module_utils/redfish_utils.py
+++ b/plugins/module_utils/redfish_utils.py
@@ -1586,13 +1586,14 @@ def set_boot_override(self, boot_opts):
 
         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')


Test patch: