Add a vmware_datastore_facts module (#30815)

Fix a bunch of things mentioned in the review.

Delete commented code from module.  Add fix for vcsim not returning
uncommitted.
Add integration test.

Add changes suggested
This commit is contained in:
Tim Rightnour 2017-12-10 08:55:55 -07:00 committed by ansibot
parent 326b208b19
commit 51475cd623
4 changed files with 335 additions and 0 deletions

View file

@ -144,6 +144,21 @@ def find_datacenter_by_name(content, datacenter_name):
return None
def get_parent_datacenter(obj):
""" Walk the parent tree to find the objects datacenter """
if isinstance(obj, vim.Datacenter):
return obj
datacenter = None
while True:
if not hasattr(obj, 'parent'):
break
obj = obj.parent
if isinstance(obj, vim.Datacenter):
datacenter = obj
break
return datacenter
def find_datastore_by_name(content, datastore_name):
datastores = get_all_objs(content, [vim.Datastore])