From dc1ba4144ce4fca9bd24012337aeb2e4c6acfa61 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 23 Oct 2026 15:48:05 +0200 Subject: [PATCH] fix(roles): name the redirect loop variable and drop a tmpdir default A looped include that leaves its variable as item inherits whatever a loop inside the included file binds, so the redirect loop now names it and the include reads that name. Nothing in the role referred to item, so the rename reaches every read. The variants test asked the environment for TMPDIR and substituted /tmp when it was unset, which is the silent fallback the project forbids; tempfile.gettempdir() already knows the order to try. Co-Authored-By: Claude Opus 5 (1M context) --- roles/test-e2e-playwright/vars/main.yml | 4 ++-- roles/web-opt-rdr-domains/tasks/main.yml | 6 ++++-- tests/unit/python/utils/cache/test_variants.py | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/roles/test-e2e-playwright/vars/main.yml b/roles/test-e2e-playwright/vars/main.yml index 54b5508e14..0abfd65243 100644 --- a/roles/test-e2e-playwright/vars/main.yml +++ b/roles/test-e2e-playwright/vars/main.yml @@ -27,8 +27,8 @@ TEST_E2E_PLAYWRIGHT_PERSONAS_ARCHIVE: "/tmp/infinito-playwright-personas.tar" TEST_E2E_PLAYWRIGHT_SHARED_STAMP: "{{ TEST_E2E_PLAYWRIGHT_SHARED_DIR }}/.installed-version" TEST_E2E_PLAYWRIGHT_IS_ONION: "{{ (_playwright_pass_domain | network_of) == 'tor' }}" -TEST_E2E_PLAYWRIGHT_PROXY: "{{ ('socks5://' ~ lookup('tor_socks', '127.0.0.1' if IS_SWARM_MODE else 'host.docker.internal')) if (TEST_E2E_PLAYWRIGHT_IS_ONION - | bool) else '' }}" +TEST_E2E_PLAYWRIGHT_PROXY: "{{ ('socks5://' ~ lookup('tor_socks', '127.0.0.1' if IS_SWARM_MODE else 'host.docker.internal')) if (TEST_E2E_PLAYWRIGHT_IS_ONION | bool) + else '' }}" TEST_E2E_PLAYWRIGHT_ONION_RUN_TIMEOUT: 5400 TEST_E2E_PLAYWRIGHT_ROLE_RUN_TIMEOUT: "{{ lookup('role_tests', application_id, 'playwright.timeout', default='') }}" diff --git a/roles/web-opt-rdr-domains/tasks/main.yml b/roles/web-opt-rdr-domains/tasks/main.yml index 3996dc5813..3cf40fd547 100644 --- a/roles/web-opt-rdr-domains/tasks/main.yml +++ b/roles/web-opt-rdr-domains/tasks/main.yml @@ -10,6 +10,8 @@ - name: "📂 Include domains redirects" include_tasks: redirect-domain.yml vars: - domain: "{{ item.source }}" - target: "{{ item.target }}" + domain: "{{ redirect_domain.source }}" + target: "{{ redirect_domain.target }}" loop: "{{ lookup('network_redirects', redirect_domain_mappings) }}" + loop_control: + loop_var: redirect_domain diff --git a/tests/unit/python/utils/cache/test_variants.py b/tests/unit/python/utils/cache/test_variants.py index 5af77bc90f..cfe566aa81 100644 --- a/tests/unit/python/utils/cache/test_variants.py +++ b/tests/unit/python/utils/cache/test_variants.py @@ -5,6 +5,7 @@ no inventory-level `applications.` override is set.""" import os import sys +import tempfile import textwrap import unittest from pathlib import Path @@ -305,7 +306,7 @@ class TestReadonlyVariants(unittest.TestCase): def setUp(self) -> None: _reset_cache_for_tests() - self.tmp = Path(os.environ.get("TMPDIR", "/tmp")) / "readonly-variants-roles" + self.tmp = Path(tempfile.gettempdir()) / "readonly-variants-roles" _write_role( self.tmp, "web-app-one",