mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-13 19:59:10 -07:00
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:
parent
326b208b19
commit
51475cd623
4 changed files with 335 additions and 0 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue