With Python3, we cannot iterate on a dict and modify it at the same time. Fixes ##54869
This commit is contained in:
parent
bd0792397b
commit
339a0f4a8c
1 changed files with 3 additions and 1 deletions
|
@ -214,10 +214,12 @@ class PyVmomiCache(object):
|
|||
if confine_to_datacenter:
|
||||
if hasattr(objects, 'items'):
|
||||
# resource pools come back as a dictionary
|
||||
tmpobjs = objects.copy()
|
||||
for k, v in objects.items():
|
||||
parent_dc = get_parent_datacenter(k)
|
||||
if parent_dc.name != self.dc_name:
|
||||
objects.pop(k, None)
|
||||
tmpobjs.pop(k, None)
|
||||
objects = tmpobjs
|
||||
else:
|
||||
# everything else should be a list
|
||||
objects = [x for x in objects if get_parent_datacenter(x).name == self.dc_name]
|
||||
|
|
Loading…
Reference in a new issue