mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
vmware_guest: fixes for cache objects and datacenter association (#26719)
* vmware_guest: fixes for cache objects and datacenter association * find_all_objs was only looking for datastores * Clear the result if it's datacenter is not correct. * Re-enable pyvmomi installation Addresses #25011 Addresses #26511
This commit is contained in:
parent
c22ec81b99
commit
df507ca9c4
2 changed files with 7 additions and 7 deletions
|
@ -449,16 +449,16 @@ class PyVmomiCache(object):
|
|||
result = find_obj(content, types, name)
|
||||
if result and confine_to_datacenter:
|
||||
if self.get_parent_datacenter(result).name != self.dc_name:
|
||||
result = None
|
||||
objects = self.get_all_objs(content, types, confine_to_datacenter=True)
|
||||
for obj in objects:
|
||||
if obj.name == name:
|
||||
if name is None or obj.name == name:
|
||||
return obj
|
||||
|
||||
return result
|
||||
|
||||
def get_all_objs(self, content, types, confine_to_datacenter=True):
|
||||
""" Wrapper around get_all_objs to set datacenter context """
|
||||
objects = get_all_objs(content, [vim.Datastore])
|
||||
objects = get_all_objs(content, types)
|
||||
if confine_to_datacenter:
|
||||
if hasattr(objects, 'items'):
|
||||
# resource pools come back as a dictionary
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#- name: make sure pyvmomi is installed
|
||||
# pip:
|
||||
# name: pyvmomi
|
||||
# state: latest
|
||||
- name: make sure pyvmomi is installed
|
||||
pip:
|
||||
name: pyvmomi
|
||||
state: latest
|
||||
|
||||
- name: store the vcenter container ip
|
||||
set_fact:
|
||||
|
|
Loading…
Reference in a new issue