X Tutup
Skip to content

Commit 3cb4491

Browse files
committed
identity: Fix project list
SDK returns generators, not lists, and we do not see errors until they are iterated. Force early iteration by wrapping then in a list to ensure we actually see the HTTP 403 errors we were expecting. Change-Id: I0ab72e587bf4e16ae877db7a81023a226124e4d5 Signed-off-by: Stephen Finucane <stephenfin@redhat.com> (cherry picked from commit 02b5630a9f9bf8bbc62d17542f61e769c2cb7fd1)
1 parent 24e6fec commit 3cb4491

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

openstackclient/identity/v3/project.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,21 @@ def take_action(self, parsed_args):
342342
user = self.app.client_manager.auth_ref.user_id
343343

344344
if user:
345-
data = identity_client.user_projects(user, **kwargs)
345+
data = list(identity_client.user_projects(user, **kwargs))
346346
else:
347347
try:
348-
data = identity_client.projects(**kwargs)
348+
data = list(identity_client.projects(**kwargs))
349349
except sdk_exc.ForbiddenException:
350350
# NOTE(adriant): if no filters, assume a forbidden is non-admin
351351
# wanting their own project list.
352352
if not kwargs:
353353
user = self.app.client_manager.auth_ref.user_id
354-
data = identity_client.user_projects(user)
354+
data = list(identity_client.user_projects(user))
355355
else:
356356
raise
357357

358358
if parsed_args.sort:
359-
data = utils.sort_items(data, parsed_args.sort)
359+
data = list(utils.sort_items(data, parsed_args.sort))
360360

361361
return (
362362
column_headers,

0 commit comments

Comments
 (0)
X Tutup