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