waft.test_resource_manager.vm.vm_manager module

Simplified VM operations module.

class waft.test_resource_manager.vm.vm_manager.VmManager(config_file_path: Path | None = None, terraform_templates_path: Path | None = None, terraform_specs_path: Path | None = None)

Bases: object

Simplified VM manager that orchestrates VM operations using specialized components.

create_vm(system: UserConfiguredSystem) VmResult

Create a VM using Terraform, automatically discovering and configuring a proxy if found.

Parameters:

system – The system configuration object.

Returns:

VmResult with operation result.

create_vm_from_params(vm_spec: str, system_name: str, username: str, resource_group: str, cloud_provider: CloudProvider = CloudProvider.AZURE, force: bool = False) VmResult

Create a VM from parameters and add it to the config.

Parameters:
  • vm_spec – VM specification name

  • system_name – System name for the VM

  • username – Username for the VM

  • resource_group – Azure resource group name

  • cloud_provider – Cloud provider (defaults to Azure)

  • force – Whether to force creation if system exists

Returns:

VmResult with operation result

Raises:

Exception – If VM creation fails

delete_vm(system_name: str, delete_from_config: bool = False) VmResult

Delete a VM using Terraform.

Parameters:
  • system_name – Name of the system to delete

  • delete_from_config – Whether to completely remove the system from config (default: just clear hostname)

Returns:

VmResult with operation result

export_vm(system_name: str, locked: bool) str

Export a VM configuration.

Parameters:
  • system_name (str) – System name for the VM

  • locked (bool) – True to export a locked configuration, False to export an unlocked configuration

Returns:

Exported configuration file path

Return type:

str

import_vm(system_name: str, force: bool, import_zip: Path)

Import a VM configuration.

Parameters:
  • system_name (str) – System name for the VM

  • force (bool) – Whether to force import if system already exists with the specified name

  • import_zip (Path) – Configuration file to import