1
0
mirror of https://github.com/vmware/vsphere-automation-sdk-python.git synced 2024-11-26 11:19:59 -05:00

Modified to incorporate review comments

This commit is contained in:
pgbidkar 2017-02-06 03:36:00 -08:00
parent be3b51e4b7
commit 2ecbca4718

View File

@ -12,6 +12,7 @@
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
"""
import atexit
from samples.vsphere.common import vapiconnect
from samples.vsphere.common.sample_util import parse_cli_args
from samples.vsphere.common.sample_util import pp
@ -34,37 +35,30 @@ def setup(context=None):
username,
password,
skip_verification)
#atexit.register(vapiconnect.logout, stub_config)
atexit.register(vapiconnect.logout, stub_config)
def run():
list_vms(stub_config)
def list_vms(stub_config):
"""
List VMs present in server
"""
vm_svc = VM(stub_config)
list_of_vms = vm_svc.list()
print "----------------------------"
print "List Of VMs"
print "----------------------------"
for vm in list_of_vms:
print ('{}'.format(vm))
def cleanup():
pass
print "----------------------------"
def main():
try:
setup()
cleanup()
run()
if cleardata:
cleanup()
finally:
if stub_config:
vapiconnect.logout(stub_config)
pass
if __name__ == '__main__':