diff --git a/changelogs/fragments/64797-fix-error-deleting-redfish-acct.yaml b/changelogs/fragments/64797-fix-error-deleting-redfish-acct.yaml new file mode 100644 index 0000000000..ed306a8c20 --- /dev/null +++ b/changelogs/fragments/64797-fix-error-deleting-redfish-acct.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - redfish_command - fix error when deleting a disabled Redfish account (https://github.com/ansible/ansible/issues/64684) diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index 97bbf30d7d..77f0977227 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -991,7 +991,7 @@ class RedfishUtils(object): return {'ret': True, 'changed': False} payload = {'UserName': ''} - if 'Enabled' in data: + if data.get('Enabled', False): payload['Enabled'] = False response = self.patch_request(self.root_uri + uri, payload) if response['ret'] is False: