From ed3d4453967a8197e76c9e964dd82f062de1de74 Mon Sep 17 00:00:00 2001 From: Paulo Date: Sat, 19 Sep 2026 10:34:17 +0200 Subject: [PATCH] DRU-579 -- Stop sending the default image with a template --- backend/druks/sandbox/client.py | 6 +++++- backend/tests/test_sandbox_aws_direct.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/druks/sandbox/client.py b/backend/druks/sandbox/client.py index 184b93e8..f54ed901 100644 --- a/backend/druks/sandbox/client.py +++ b/backend/druks/sandbox/client.py @@ -93,7 +93,11 @@ async def acquire( api = self._api() try: settings = load_settings() - image = image_override or settings.sandbox.image + if template: + # A template names its own image, built on the installation image. + image = None + else: + image = image_override or settings.sandbox.image # drukbox reaps the host at lease end, so a dead worker still frees its VM. expires_at = datetime.now(UTC) + timedelta(seconds=SANDBOX_HOST_LEASE_SECONDS) try: diff --git a/backend/tests/test_sandbox_aws_direct.py b/backend/tests/test_sandbox_aws_direct.py index a66871bd..7bd63933 100644 --- a/backend/tests/test_sandbox_aws_direct.py +++ b/backend/tests/test_sandbox_aws_direct.py @@ -204,7 +204,7 @@ async def test_acquire_persists_private_key_when_returned( assert oct(os.stat(key_path).st_mode & 0o777) == "0o600" -async def test_acquire_passes_template_to_drukbox( +async def test_acquire_sends_a_template_without_the_installation_image( monkeypatch: pytest.MonkeyPatch, tmp_path: Path, ): @@ -214,6 +214,7 @@ async def test_acquire_passes_template_to_drukbox( pass assert calls[0]["template"] == "template-1" + assert calls[0]["image"] is None async def test_acquire_sends_no_template_by_default(