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) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-23 15:48:05 +02:00
1 parent a4c7fda974
commit dc1ba4144c
3 files changed
+8 -5

No files matched your search

+2 -1
View File
@@ -5,6 +5,7 @@ no inventory-level `applications.<app>` 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",