box_walk: Tester 1's guest address is read from the guest (DHCP: .101 -> .148 on 2026-10-23), like 9202's; the test pins both DHCP rows
gates / gates (push) Successful in 54s
gates / gates (push) Successful in 54s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qRErfCoiTkvDK9N5XHbzb
This commit is contained in:
1 parent
3898593594
commit
3d98779869
4 files changed
+24
-15
No files matched your search
+13
-13
@@ -34,7 +34,7 @@ DRILL = "/mnt/5_hdd/felhom.eu/drill/app-catalog-drill"
|
||||
# TARGET=9202 (default) scratch guest 9202 on demo-hp
|
||||
# TARGET=9201 demo-hp's hub-enabled guest (the mail proof) — household-shaped, never seeded through an admin
|
||||
# TARGET=tester-1 the Tester 1 box: VM 341 on the HP box (`09` §3 decision 158), its node `felhom` at
|
||||
# 192.168.0.154, guest 9201 at 192.168.0.101 for felhom.enkicsifelhom.hu (identity matched
|
||||
# 192.168.0.154, guest 9201 (DHCP — read at start) for felhom.enkicsifelhom.hu (identity matched
|
||||
# 2026-10-06: the agent's report `host.node=felhom` = the VM's certificate; the guest answers
|
||||
# that domain, the other one 404 — `felhom.eu/documentation/audits/readback-2026-10-07/`)
|
||||
# GUEST=<vmid> still selects a demo-hp row (the old switch), unless TARGET is set.
|
||||
@@ -46,7 +46,7 @@ TARGETS = {
|
||||
"9201": {"hp": "demo-hp", "ssh": "demo-hp", "jump": None, "guest": "9201",
|
||||
"base": "https://192.168.0.155", "domain": "enkisfelhom.hu"},
|
||||
"tester-1": {"hp": "tester-1", "ssh": "root@192.168.0.154", "jump": "demo-hp", "guest": "9201",
|
||||
"base": "https://192.168.0.101", "domain": "enkicsifelhom.hu"},
|
||||
"base": None, "domain": "enkicsifelhom.hu"}, # DHCP: .101 until 2026-10-23, then .148 — read
|
||||
}
|
||||
TARGET = os.environ.get("TARGET") or os.environ.get("GUEST", "9202")
|
||||
if TARGET not in TARGETS:
|
||||
@@ -55,9 +55,19 @@ _T = TARGETS[TARGET]
|
||||
GUEST = _T["guest"]
|
||||
|
||||
|
||||
def ssh_args():
|
||||
"""The ssh argv prefix that reaches the target's Proxmox host (a jump when the row names one)."""
|
||||
a = ["ssh", "-o", "ConnectTimeout=20", "-o", "StrictHostKeyChecking=accept-new"]
|
||||
if _T["jump"]:
|
||||
a += ["-J", _T["jump"]]
|
||||
return a + [_T["ssh"]]
|
||||
|
||||
LOG = []
|
||||
|
||||
|
||||
def resolve_base():
|
||||
"""A DHCP guest's dashboard address, read from the guest itself over the host's pct (no guessing)."""
|
||||
r = subprocess.run(["ssh", "-o", "ConnectTimeout=20", _T["ssh"], "pct", "exec", _T["guest"], "--", "ip", "-4", "-o",
|
||||
r = subprocess.run(ssh_args() + ["pct", "exec", _T["guest"], "--", "ip", "-4", "-o",
|
||||
"addr", "show", "eth0"], capture_output=True, text=True, timeout=60)
|
||||
m = re.search(r"inet (\d+\.\d+\.\d+\.\d+)/", r.stdout)
|
||||
if not m:
|
||||
@@ -72,16 +82,6 @@ HOSTHDR = f"Host: felhom.{DOMAIN}"
|
||||
HP = _T["hp"]
|
||||
|
||||
|
||||
def ssh_args():
|
||||
"""The ssh argv prefix that reaches the target's Proxmox host (a jump when the row names one)."""
|
||||
a = ["ssh", "-o", "ConnectTimeout=20", "-o", "StrictHostKeyChecking=accept-new"]
|
||||
if _T["jump"]:
|
||||
a += ["-J", _T["jump"]]
|
||||
return a + [_T["ssh"]]
|
||||
|
||||
LOG = []
|
||||
|
||||
|
||||
def say(*a):
|
||||
line = " ".join(str(x) for x in a)
|
||||
ts = datetime.now().strftime("%H:%M:%S")
|
||||
|
||||
@@ -416,7 +416,8 @@ class BoxWalkTargets(unittest.TestCase):
|
||||
for name, row in bw.TARGETS.items():
|
||||
self.assertEqual(set(row), {"hp", "ssh", "jump", "guest", "base", "domain"}, name)
|
||||
self.assertTrue(row["base"] is None or row["base"].startswith("https://"), name)
|
||||
self.assertIsNone(bw.TARGETS["9202"]["base"], "9202 is DHCP: its address is read from the guest, never typed")
|
||||
for dhcp in ("9202", "tester-1"): # Tester 1's guest moved .101 -> .148 on 2026-10-23
|
||||
self.assertIsNone(bw.TARGETS[dhcp]["base"], "%s is DHCP: its address is read from the guest, never typed" % dhcp)
|
||||
|
||||
def test_the_default_stays_scratch_9202(self):
|
||||
bw = self.load({"BASE": "https://192.0.2.1"})
|
||||
@@ -429,7 +430,7 @@ class BoxWalkTargets(unittest.TestCase):
|
||||
self.assertEqual((bw.HP, bw.GUEST, bw.BASE), ("demo-hp", "9201", "https://192.168.0.155"))
|
||||
|
||||
def test_the_tester_1_box_is_reached_through_the_hp_box(self):
|
||||
bw = self.load({"TARGET": "tester-1"})
|
||||
bw = self.load({"TARGET": "tester-1", "BASE": "https://192.0.2.1"})
|
||||
self.assertEqual((bw.HP, bw.GUEST, bw.DOMAIN), ("tester-1", "9201", "enkicsifelhom.hu"))
|
||||
a = bw.ssh_args()
|
||||
self.assertEqual(a[a.index("-J") + 1], "demo-hp")
|
||||
|
||||
Reference in new issue
Block a user