COT.vm_context_manager module

Context manager for virtual machine definitions.

class VMContextManager(input_file, output_file=None)[source]

Bases: object

Context manager for virtual machine definitions.

When the context manager exits, unless an error occurred, the virtual machine’s write() method is called. Regardless of whether an error occurred, the virtual machine’s destroy() method is then called.

Use as follows:

with VMContextManager(input_file, output_file) as vm:
    vm.foo()
    vm.bar()

For the parameters, see VMDescription.

__init__(input_file, output_file=None)[source]

Create a VM instance.

For the parameters, see VMDescription.