Do not resize while iterating

This commit is contained in:
Joseph Hall 2015-07-08 10:29:22 -06:00
parent e6251e78eb
commit 4f2abe5cba

View File

@ -690,10 +690,14 @@ def reformat_node(item=None, full=False):
item[key] = None
# remove all the extra key value pairs to provide a brief listing
to_del = []
if not full:
for key in six.iterkeys(item): # iterate over a copy of the keys
if key not in desired_keys:
del item[key]
to_del.append(key)
for key in to_del:
del item[key]
if 'state' in item:
item['state'] = joyent_node_state(item['state'])