diff --git a/changelogs/fragments/6771-redfish-filter-empty-account-slots.yml b/changelogs/fragments/6771-redfish-filter-empty-account-slots.yml new file mode 100644 index 0000000000..82e74af583 --- /dev/null +++ b/changelogs/fragments/6771-redfish-filter-empty-account-slots.yml @@ -0,0 +1,2 @@ +bugfixes: + - redfish_info - fix ``ListUsers`` to not show empty account slots (https://github.com/ansible-collections/community.general/issues/6771, https://github.com/ansible-collections/community.general/pull/6772). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 9b64703027..73f1688f29 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1079,6 +1079,12 @@ class RedfishUtils(object): if property in data: user[property] = data[property] + # Filter out empty account slots + # An empty account slot can be detected if the username is an empty + # string and if the account is disabled + if user.get('UserName', '') == '' and not user.get('Enabled', False): + continue + users_results.append(user) result["entries"] = users_results return result