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:
jctanner 2017-07-12 17:10:48 -04:00 committed by GitHub
parent c22ec81b99
commit df507ca9c4
2 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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: