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 00000000000..82e74af583c --- /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 027ce563085..6f010bbc9be 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1144,6 +1144,12 @@ def list_users(self): 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