[PR #6772/93f5a48b backport][stable-7] Redfish: Filter empty account slots from ListUsers (#6794)

Redfish: Filter empty account slots from ListUsers (#6772)

* Redfish: Filter empty account slots from ListUsers

Signed-off-by: Mike Raineri <michael.raineri@dell.com>

* Update 6771-redfish-filter-empty-account-slots.yml

* Update changelogs/fragments/6771-redfish-filter-empty-account-slots.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Signed-off-by: Mike Raineri <michael.raineri@dell.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 93f5a48b8c)

Co-authored-by: Mike Raineri <mraineri@gmail.com>
This commit is contained in:
patchback[bot] 2023-06-27 07:07:58 +02:00 committed by GitHub
parent dc898dfdf8
commit fd3bc75fb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -1144,6 +1144,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