Skip to content

Remove the output file before creating the parallel port #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions samples/vsphere/vcenter/vm/hardware/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def run():
print('vm.hardware.Parallel.get({}, {}) -> {}'.format(vm, parallel, pp(
parallel_info)))

# Make sure output file doesn't exist already
cleanup_backends()

print('\n# Example: Create Parallel port with defaults')
parallel_create_spec = Parallel.CreateSpec()
parallel = parallel_svc.create(vm, parallel_create_spec)
Expand Down Expand Up @@ -180,6 +183,9 @@ def run():
print('vm.hardware.Parallel.list({}) -> {}'.
format(vm, parallel_summaries))

# Always cleanup output file so the VM can be powered on next time
cleanup_backends()


def cleanup():
print('\n# Cleanup: Delete VM Parallel ports that were added')
Expand All @@ -193,8 +199,6 @@ def cleanup():
print('vm.hardware.Parallel WARNING: '
'Final Parallel ports info does not match original')

cleanup_backends()


def cleanup_backends():
"""
Expand Down
5 changes: 3 additions & 2 deletions samples/vsphere/vcenter/vm/hardware/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ def run():
serial_summaries = serial_svc.list(vm=vm)
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():
print('\n# Delete VM Serial ports that were added')
Expand All @@ -227,8 +230,6 @@ def cleanup():
print('vm.hardware.Serial WARNING: '
'Final Serial ports info does not match original')

cleanup_backends()


def cleanup_backends():
"""
Expand Down