Fix RuntimeError when showing project which has extra properties

If you use python3, items() returns iterator which is not allowed to
remove item during iteration. Fix to iterate by copied list.

Change-Id: I64c037d04e2b127d8f19f56cab65122af89a7200
Closes-Bug: 1740232
This commit is contained in:
Yang Youseok 2017-12-27 18:34:11 +09:00 committed by Dean Troyer
parent 8c5f755569
commit 71f138b172
2 changed files with 6 additions and 1 deletions
openstackclient/identity/v2_0
releasenotes/notes

@ -289,7 +289,7 @@ class ShowProject(command.ShowOne):
# the API has and handle the extra top level properties. # the API has and handle the extra top level properties.
reserved = ('name', 'id', 'enabled', 'description') reserved = ('name', 'id', 'enabled', 'description')
properties = {} properties = {}
for k, v in info.items(): for k, v in list(info.items()):
if k not in reserved: if k not in reserved:
# If a key is not in `reserved` it's a property, pop it # If a key is not in `reserved` it's a property, pop it
info.pop(k) info.pop(k)

@ -0,0 +1,5 @@
---
fixes:
- |
Fix RuntimeError in ``project show`` command running under Python 3.
[Bug `1740232 <https://bugs.launchpad.net/python-openstackclient/+bug/1740232>`_]