From affaf9177159aa5fafccbaef8efd81bee6cb0c7b Mon Sep 17 00:00:00 2001 From: Ana Maria Martinez Gomez Date: Fri, 30 Aug 2024 09:03:29 +0200 Subject: [PATCH] [vbox-export-snapshots] Add EXPORTED_VM_NAME Add a `EXPORTED_VM_NAME` constant variable to easily configure the base name of the exported VMs for more flexibility. --- virtualbox/vbox-export-snapshots.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/virtualbox/vbox-export-snapshots.py b/virtualbox/vbox-export-snapshots.py index c371e95..1abd8cc 100755 --- a/virtualbox/vbox-export-snapshots.py +++ b/virtualbox/vbox-export-snapshots.py @@ -12,8 +12,10 @@ from virtualbox.library import NetworkAttachmentType as NetType from datetime import datetime +# Base name of the exported VMs +EXPORTED_VM_NAME = "FLARE-VM" # Name of the VM to export the snapshots from -VM_NAME = "FLARE-VM.testing" +VM_NAME = f"{EXPORTED_VM_NAME}.testing" # Name of the directory in HOME to export the VMs # The directory is created if it does not exist @@ -63,7 +65,7 @@ def change_network_adapters(vm, max_adapters): print(f"Restored '{snapshot_name}' and changed its adapter(s) to host-only") # Export .ova - exported_vm_name = f"FLARE-VM.{date}{extension}" + exported_vm_name = f"{EXPORTED_VM_NAME}.{date}{extension}" export_directory = os.path.expanduser(f"~/{EXPORT_DIR_NAME}") os.makedirs(export_directory, exist_ok=True) filename = os.path.join(export_directory, f"{exported_vm_name}.ova")