Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Own native updater scratch before child observation
pulse-triage[bot]8cb66ef0f7f9
diff --git a/scripts/installtests/auto_update_systemd.py b/scripts/installtests/auto_update_systemd.pyindex 082610bace..e1d2feaab0 100644--- a/scripts/installtests/auto_update_systemd.py+++ b/scripts/installtests/auto_update_systemd.py@@ -191,10 +191,13 @@ class NativeLab:for path in (self.unit, Path("/run/systemd/system") / self.unit.name):if path.exists() or path.is_symlink():raise ValueError("native fixture unit already exists")- if self.state()["LoadState"] != "not-found":- raise ValueError("native fixture unit is already known to systemd")+ # Own the fresh scratch/HOME before launching any child. A platform+ # runtime may initialise HOME even for a read-only manager observation.+ # mkdir remains exclusive: never adopt or clean a pre-existing path.self.root.mkdir(mode=0o755) # A pulse-owned service must traverse it.self.owned_root = True+ if self.state()["LoadState"] != "not-found":+ raise ValueError("native fixture unit is already known to systemd")for name in ("tools", "tmp", "archives", "signer"):(self.root / name).mkdir(mode=0o700 if name == "signer" else 0o755)source = (self.repo / "install.sh").read_text()diff --git a/scripts/tests/test_auto_update_systemd.py b/scripts/tests/test_auto_update_systemd.pyindex 5fad02f539..63dae834c3 100644--- a/scripts/tests/test_auto_update_systemd.py+++ b/scripts/tests/test_auto_update_systemd.py@@ -188,6 +188,59 @@ class NativeContracts(unittest.TestCase):self.assertTrue(marker.exists())self.assertFalse(lab.receipt["cleanup"]["owned_fixture_removed"])+ def test_prepare_allocates_scratch_before_child_home_initialisation(self):+ # Model a child runtime that eagerly initialises HOME. This catches the+ # macOS control's FileExistsError without pretending to run systemd.+ for load in ("not-found", "loaded"):+ with self.subTest(load=load), tempfile.TemporaryDirectory() as directory:+ base = Path(directory)+ before, after = base / "a", base / "b"+ before.write_bytes(b"before\n"); after.write_bytes(b"after\n")+ lab = native.NativeLab(base / "lab", ROOT, before, after, "a" * 40)+ lab.unit = base / "absent.service"+ def child_observation():+ lab.root.mkdir(exist_ok=True)+ (lab.root / "child-home-marker").write_text("runtime initialised HOME\n")+ return {"LoadState": load}+ def bounded_command(*args, **kwargs):+ if args[0] in (str(before), str(after)) and args[1:] == ("--version",):+ tag = native.TAGS[0 if args[0] == str(before) else 1]+ return subprocess.CompletedProcess(args, 0, ("Pulse " + tag + "\n").encode())+ raise RuntimeError("stop before signer or service mutation")+ with patch.object(lab, "state", side_effect=child_observation) as observation, \+ patch.object(lab, "run", side_effect=bounded_command):+ expected = ValueError if load == "loaded" else RuntimeError+ with self.assertRaises(expected):+ lab.prepare()+ observation.assert_called_once()+ self.assertTrue(lab.owned_root)+ self.assertTrue((lab.root / "child-home-marker").exists())+ self.assertFalse(lab.owned_unit)+ self.assertFalse(lab.owned_user)+ lab.cleanup()+ self.assertFalse(lab.root.exists())+ self.assertTrue(lab.receipt["cleanup"]["complete"])++ def test_prepare_refuses_existing_directory_or_symlink_before_child(self):+ for symlink in (False, True):+ with self.subTest(symlink=symlink), tempfile.TemporaryDirectory() as directory:+ base = Path(directory); prior = base / "prior"; prior.mkdir()+ marker = prior / "keep"; marker.write_text("not ours\n")+ root = base / "lab" if symlink else prior+ if symlink:+ root.symlink_to(prior, target_is_directory=True)+ lab = native.NativeLab(root, ROOT, base / "a", base / "b", "a" * 40)+ lab.unit = base / "absent.service"+ with patch.object(lab, "state", side_effect=AssertionError("unowned child")) as observation:+ with self.assertRaises(FileExistsError):+ lab.prepare()+ observation.assert_not_called()+ self.assertFalse(lab.owned_root)+ lab.cleanup()+ self.assertEqual(marker.read_text(), "not ours\n")+ self.assertTrue(root.exists())+ self.assertFalse(lab.receipt["cleanup"]["owned_fixture_removed"])+def run_recipe(self, failure="", mismatch=False):with tempfile.TemporaryDirectory() as directory:root = Path(directory); tools = root / "tools"; tools.mkdir()