Merge pull request #426 from martinmosegaard/master

Fix #351: Detect vApps in getallvms sample
This commit is contained in:
Tianhao He 2016-08-27 22:12:07 -07:00 committed by GitHub
commit ec88233535
1 changed files with 9 additions and 1 deletions

View File

@ -48,7 +48,7 @@ def GetArgs():
def PrintVmInfo(vm, depth=1):
"""
Print information for a particular virtual machine or recurse into a folder
with depth protection
or vApp with depth protection
"""
maxdepth = 10
@ -62,6 +62,14 @@ def PrintVmInfo(vm, depth=1):
PrintVmInfo(c, depth+1)
return
# if this is a vApp, it likely contains child VMs
# (vApps can nest vApps, but it is hardly a common usecase, so ignore that)
if isinstance(vm, vim.VirtualApp):
vmList = vm.vm
for c in vmList:
PrintVmInfo(c, depth + 1)
return
summary = vm.summary
print("Name : ", summary.config.name)
print("Path : ", summary.config.vmPathName)