diff --git a/scripts/integration-vm.py b/scripts/integration-vm.py index b5ec90e..02c655c 100644 --- a/scripts/integration-vm.py +++ b/scripts/integration-vm.py @@ -201,6 +201,13 @@ def up(host, name=None, mem_mib=DEFAULT_MEM_MIB, vcpus=DEFAULT_VCPUS): sh(["cloud-localds", "--network-config", str(RUN_DIR / "network-config"), str(seed), str(RUN_DIR / "user-data"), str(RUN_DIR / "meta-data")]) console = CACHE_DIR / f"{name}-console.log" + # virt-install has a `#!/usr/bin/env python3` shebang; the Makefile prepends .venv/bin to + # PATH (so the venv's ansible tools resolve), which would hijack virt-install into the + # isolated venv — it lacks system PyGObject (`gi`) and crashes. Strip the venv from PATH + # for this system tool so its shebang finds /usr/bin/python3 (which has gi). Ansible is + # invoked via its absolute .venv path elsewhere, so it is unaffected. + sys_path = ":".join(p for p in os.environ.get("PATH", "").split(":") + if "/.venv/bin" not in p) sh(["virt-install", "--name", name, "--memory", str(mem_mib), "--vcpus", str(vcpus), "--boot", "uefi", # genericcloud triple-faults on legacy BIOS handoff; UEFI boots "--import", @@ -210,7 +217,8 @@ def up(host, name=None, mem_mib=DEFAULT_MEM_MIB, vcpus=DEFAULT_VCPUS): "--osinfo", "debian13", "--graphics", "none", "--serial", f"file,path={console}", - "--noautoconsole"]) + "--noautoconsole"], + env=dict(os.environ, PATH=sys_path)) ip = wait_for_ip(name) wait_for_ssh(ip, "ansible") # Block until cloud-init finishes (incl. apt-get update) so apply sees a ready system.