Skip to main content

Wrapper tool around VBoxManage that facilitates the orchestration of VBoxManage commands from a simple YAML configuration file that matches the input opts/args for VBoxManage.

Project description

PyVBoxManage

PyPi Python Versions Build Status Read the Docs License

PyVBoxManage is a wrapper tool around VBoxManage that facilitates the orchestration of VBoxManage commands from a simple YAML configuration file that matches the input opts/args for VBoxManage. This makes it possible to implement common sequences of VBoxManage commands such as spinning up a new dev/test instance with different hardware just by using a single command line with a configuration file.

Variables, output redirection, exit-triggers and returncode-exceptions are available to make flexible setups.

Features

  • Template variables
  • Output redirection to STDOUT, STDERR, filename
  • Exit triggers on string match within STDOUT or STDERR content (useful to prevent cloning/clobbering instance that is already running )
  • Permit exit returncodes other than 0 in cases where they may occur (eg configuring a --delete action when the instance does not yet exist)
  • Dry mode to test configurations before running them
  • Manage timeouts to prevent excessively long running VBoxManage commands (default 120 seconds, useful to prevent stalled VBoxManage tasks)
  • Variable overrides through command line args are possible
  • Documentation https://pyvboxmanage.readthedocs.io

Installation

user@computer:~$ pip install pyvboxmanage

Command Line Usage

Run a pyvboxmanage example configuration with --verbose logging output and override the variable target_vmname with a new value using the --setting argument.

user@computer:~$ pyvboxmanage --verbose examples/example01.yml --setting target_vmname=MyNewName  
DEBUG - pyvboxmanage v0.4.0
DEBUG - Loaded configuration file examples/example01.yml
DEBUG - Dry mode VBoxManage binary set to vboxmanage
DEBUG - Rendered command line: vboxmanage showvminfo MyNewName
DEBUG - Command line exec timeout 120
INFO - Successfully executed command line "vboxmanage showvminfo MyNewName"
DEBUG - Trigger string "running" is not present
DEBUG - Rendered command line: vboxmanage unregistervm MyNewName --delete
DEBUG - Command line exec timeout 120
INFO - Successfully executed command line "vboxmanage unregistervm MyNewName --delete"
DEBUG - Rendered command line: vboxmanage clonevm Ubuntu-20.04-master --basefolder "/opt/virtual-machines" --groups "/cicd" --mode "machine" --name "MyNewName" --register
DEBUG - Command line exec timeout 180
INFO - Successfully executed command line "vboxmanage clonevm Ubuntu-20.04-master --basefolder "/opt/virtual-machines" --groups "/cicd" --mode "machine" --name "MyNewName" --register"
DEBUG - Rendered command line: vboxmanage modifyvm MyNewName --bridgeadapter1 "enp0s25" --bridgeadapter2 "enp0s25" --bridgeadapter3 "enp0s25" --bridgeadapter4 "enp0s25" --cableconnected1 "on" --cableconnected2 "on" --cableconnected3 "on" --cableconnected4 "on" --macaddress1 "08002722E901" --macaddress2 "08002722E902" --macaddress3 "08002722E903" --macaddress4 "08002722E904" --nic1 "bridged" --nic2 "bridged" --nic3 "bridged" --nic4 "bridged" --nictype1 "82543GC" --nictype2 "82543GC" --nictype3 "82543GC" --nictype4 "82543GC"
DEBUG - Command line exec timeout 120
INFO - Successfully executed command line "vboxmanage modifyvm MyNewName --bridgeadapter1 "enp0s25" --bridgeadapter2 "enp0s25" --bridgeadapter3 "enp0s25" --bridgeadapter4 "enp0s25" --cableconnected1 "on" --cableconnected2 "on" --cableconnected3 "on" --cableconnected4 "on" --macaddress1 "08002722E901" --macaddress2 "08002722E902" --macaddress3 "08002722E903" --macaddress4 "08002722E904" --nic1 "bridged" --nic2 "bridged" --nic3 "bridged" --nic4 "bridged" --nictype1 "82543GC" --nictype2 "82543GC" --nictype3 "82543GC" --nictype4 "82543GC""
DEBUG - Rendered command line: vboxmanage startvm MyNewName --type "gui"
DEBUG - Command line exec timeout 120
INFO - Successfully executed command line "vboxmanage startvm MyNewName --type "gui""

Plenty more configuration examples available here.

Project


Copyright © 2021 Nicholas de Jong

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvboxmanage-0.4.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvboxmanage-0.4.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file pyvboxmanage-0.4.1.tar.gz.

File metadata

  • Download URL: pyvboxmanage-0.4.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for pyvboxmanage-0.4.1.tar.gz
Algorithm Hash digest
SHA256 55fdd4f7df3fc2e20b877c51a3734f2691494fcda9f36f17dd5813553f4c6b7b
MD5 a848badff8825e79fc2568822bef1a95
BLAKE2b-256 b49c9fedcce9c37458d7b1a008b3f5ad8e984461907f593edb14abc7b01d1946

See more details on using hashes here.

File details

Details for the file pyvboxmanage-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: pyvboxmanage-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for pyvboxmanage-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ded93377798f7a24ecf5d0520a66dd3c140a6d705d23aae14e3d0b7c0075012
MD5 ada4e75a3cd64c5581866542ee05ff71
BLAKE2b-256 e0de5f2d89a6406c21a1b1f5c452e5e0ae8cb8fd2d867f2607c3443ec8f5d711

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page