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 ffcb739bd6..c16287091e 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1163,6 +1163,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