From cd88dec15deb45dba584269e44da43da06a4646b Mon Sep 17 00:00:00 2001 From: Simone Date: Tue, 9 Jun 2026 00:20:49 +0200 Subject: [PATCH] feat(prepare-win): add --gui/--nogui flag, default headless Lets `template prepare-win` start the template VM in the Workstation window (--gui) for interactive debugging; defaults to headless --nogui. --- src/ci_orchestrator/commands/template.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ci_orchestrator/commands/template.py b/src/ci_orchestrator/commands/template.py index 5b828f0..f8840e0 100644 --- a/src/ci_orchestrator/commands/template.py +++ b/src/ci_orchestrator/commands/template.py @@ -386,6 +386,9 @@ def _run_with_heartbeat( help="Keyring target name for the stored credential.") @click.option("--recreate-snapshot", is_flag=True, help="Delete and recreate the snapshot if it already exists (no prompt).") +@click.option("--gui/--nogui", "gui", default=False, show_default=True, + help="Start the VM with the Workstation window (--gui, needs an X display) " + "or headless (--nogui, the default).") def template_prepare_win( vmx: str, guest_ip: str, @@ -403,6 +406,7 @@ def template_prepare_win( store_credential: bool, credential_target: str, recreate_snapshot: bool, + gui: bool, ) -> None: """Provision a Windows template VM via pypsrp (Linux-host compatible). @@ -466,8 +470,9 @@ def template_prepare_win( handle = VmHandle(identifier=str(vmx_path), name=vmx_path.stem) if not backend.is_running(handle): - click.echo(f"[prepare-win] Starting VM: {vmx_path.name} ...") - backend.start(handle, headless=True) + mode = "GUI" if gui else "headless" + click.echo(f"[prepare-win] Starting VM ({mode}): {vmx_path.name} ...") + backend.start(handle, headless=not gui) else: click.echo(f"[prepare-win] VM already running: {vmx_path.name}")