Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Keep unexpected fresh script destinations stopped

pulse-triage[bot]de86c27e59bc
diff --git a/install.sh b/install.sh
index 9e3e7a390d..923a36e4c5 100644
--- a/install.sh
+++ b/install.sh
@@ -4112,6 +4112,11 @@ deploy_agent_scripts() {
fi
fi
if ! mv -T -n -- "$stage/next" "$live" || [[ -e "$stage/next" || -L "$stage/next" ]]; then
+ if [[ ! -e "$stage/previous" && ! -L "$stage/previous" && ( -e "$live" || -L "$live" ) ]]; then
+ rm -rf -- "$stage"
+ print_error "Unexpected agent script destination; publication is incomplete. Reconcile the destination before recovery."
+ return 2
+ fi
if [[ -d "$stage/previous" ]] &&
{ ! mv -T -n -- "$stage/previous" "$live" || [[ -e "$stage/previous" || -L "$stage/previous" ]]; }; then
print_error "Agent script publication and restore are incomplete; previous scripts retained at $stage/previous. Reconcile the destination before recovery."
diff --git a/scripts/tests/test_server_script_publication.py b/scripts/tests/test_server_script_publication.py
index 4950d1d420..afd49006b5 100644
--- a/scripts/tests/test_server_script_publication.py
+++ b/scripts/tests/test_server_script_publication.py
@@ -319,6 +319,13 @@ class ServerScriptPublication(unittest.TestCase):
self.assertFalse(e["restarted"])
self.assertIn("Pulse has not been restarted", e["result"].stderr)
self.assertNotIn("completion", e["events"])
+ for flow in ("archive", "source"):
+ with self.subTest(flow=flow, fault="conflict", existing=False):
+ e = self.exercise("conflict", flow, existing=False)
+ self.assertNotEqual(e["result"].returncode, 0)
+ self.assertFalse(e["restarted"])
+ self.assertEqual(e["contents"], {"foreign": b"foreign"})
+ self.assertIn("Pulse has not been restarted", e["result"].stderr)
def test_every_main_consumer_stops_before_markers_or_completion(self):
for flow in ("main-pinned", "main-update", "main-reinstall", "main-fresh", "main-source"):