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

Merge pull request #14 from tianhao64/master

Remove the output file before creating the parallel port
This commit is contained in:
Tianhao He 2017-03-24 20:49:24 -07:00 committed by GitHub
commit 91c837eb69
2 changed files with 9 additions and 4 deletions

View File

@ -103,6 +103,9 @@ def run():
print('vm.hardware.Parallel.get({}, {}) -> {}'.format(vm, parallel, pp( print('vm.hardware.Parallel.get({}, {}) -> {}'.format(vm, parallel, pp(
parallel_info))) parallel_info)))
# Make sure output file doesn't exist already
cleanup_backends()
print('\n# Example: Create Parallel port with defaults') print('\n# Example: Create Parallel port with defaults')
parallel_create_spec = Parallel.CreateSpec() parallel_create_spec = Parallel.CreateSpec()
parallel = parallel_svc.create(vm, parallel_create_spec) parallel = parallel_svc.create(vm, parallel_create_spec)
@ -180,6 +183,9 @@ def run():
print('vm.hardware.Parallel.list({}) -> {}'. print('vm.hardware.Parallel.list({}) -> {}'.
format(vm, parallel_summaries)) format(vm, parallel_summaries))
# Always cleanup output file so the VM can be powered on next time
cleanup_backends()
def cleanup(): def cleanup():
print('\n# Cleanup: Delete VM Parallel ports that were added') print('\n# Cleanup: Delete VM Parallel ports that were added')
@ -193,8 +199,6 @@ def cleanup():
print('vm.hardware.Parallel WARNING: ' print('vm.hardware.Parallel WARNING: '
'Final Parallel ports info does not match original') 'Final Parallel ports info does not match original')
cleanup_backends()
def cleanup_backends(): def cleanup_backends():
""" """

View File

@ -214,6 +214,9 @@ def run():
serial_summaries = serial_svc.list(vm=vm) serial_summaries = serial_svc.list(vm=vm)
print('vm.hardware.Serial.list({}) -> {}'.format(vm, serial_summaries)) print('vm.hardware.Serial.list({}) -> {}'.format(vm, serial_summaries))
# Always cleanup output file so the VM can be powered on next time
cleanup_backends()
def cleanup(): def cleanup():
print('\n# Delete VM Serial ports that were added') print('\n# Delete VM Serial ports that were added')
@ -227,8 +230,6 @@ def cleanup():
print('vm.hardware.Serial WARNING: ' print('vm.hardware.Serial WARNING: '
'Final Serial ports info does not match original') 'Final Serial ports info does not match original')
cleanup_backends()
def cleanup_backends(): def cleanup_backends():
""" """