diff --git a/src/ci_orchestrator/commands/job.py b/src/ci_orchestrator/commands/job.py index 8654fd8..162841f 100644 --- a/src/ci_orchestrator/commands/job.py +++ b/src/ci_orchestrator/commands/job.py @@ -19,10 +19,10 @@ from __future__ import annotations import json import re import shutil +import signal import subprocess import sys import tempfile -import signal import time import uuid from datetime import UTC, datetime diff --git a/src/ci_orchestrator/commands/template.py b/src/ci_orchestrator/commands/template.py index 8d9a1f7..e99ed5d 100644 --- a/src/ci_orchestrator/commands/template.py +++ b/src/ci_orchestrator/commands/template.py @@ -55,6 +55,7 @@ template prepare-win from __future__ import annotations +import contextlib import fnmatch import json import socket @@ -565,10 +566,8 @@ def template_prepare_win( ) click.echo("[prepare-win] Windows Update requires reboot — rebooting ...") - try: + with contextlib.suppress(TransportError): transport.run("Restart-Computer -Force", check=False) - except TransportError: - pass transport.close() time.sleep(30) click.echo(f"[prepare-win] Waiting for WinRM after reboot ({winrm_timeout}s) ...") @@ -638,10 +637,8 @@ Register-ScheduledTask -TaskName 'CI-StaticIp' ` # Final reboot to flush installation state click.echo("[prepare-win] Final reboot to flush installation state ...") - try: + with contextlib.suppress(TransportError): transport.run("Restart-Computer -Force", check=False) - except TransportError: - pass transport.close() time.sleep(30) click.echo("[prepare-win] Waiting for WinRM after final reboot ...") @@ -689,10 +686,8 @@ Register-ScheduledTask -TaskName 'CI-StaticIp' ` # Graceful shutdown click.echo("[prepare-win] Sending graceful shutdown ...") - try: + with contextlib.suppress(TransportError): transport.run("Stop-Computer -Force", check=False) - except TransportError: - pass finally: transport.close() diff --git a/src/ci_orchestrator/ip_pool.py b/src/ci_orchestrator/ip_pool.py index 97f2fb4..fb3b99a 100644 --- a/src/ci_orchestrator/ip_pool.py +++ b/src/ci_orchestrator/ip_pool.py @@ -17,7 +17,7 @@ and releases it on VM destroy. The guest applies the static IP at boot: (``template/guest-setup/windows/ci-static-ip.ps1``) runs at system startup as SYSTEM and applies the static IP before WinRM starts. -This eliminates the DHCP / VMware-Tools IP-detect polling loop (20–180 s +This eliminates the DHCP / VMware-Tools IP-detect polling loop (20-180 s variance observed in B7 benchmarks). After the VM reaches *running* state the host knows the IP immediately and goes straight to the transport probe.