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.

Report stopped services truthfully after unconfirmed agent removal

pulse-triage[bot]db19ad4c2805
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index a0e76ef7f8..8fc704802d 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -15,6 +15,21 @@
## Purpose
+### Uninstall errors report the service stage actually reached
+
+Missing saved-URL admission says that no service stop or disable was attempted.
+The later server-confirmation refusal instead explains that applicable
+stop/disable steps have already run, retained credentials/service files are
+not running monitoring, and no automatic restart was attempted. It requires
+trusted connectivity and same-instance registration/service-state reconciliation
+before retrying; it must not imply that retained files kept monitoring active.
+
+The existing Unix state fixture asserts both stages. The real-CLI/TLS removal
+controls assert the late message with quiescence-only events and unchanged
+saved bytes/modes on transport, identity and server refusals. These controls
+do not add restart, loosen trust, change teardown order or establish native
+service state or the cause of a reporter's removal failure.
+
### NAS utility compatibility preserves URL and lifecycle trust
The Unix installer uses explicit ASCII alphabets and whitespace for `tr`, not
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 4b399f3a0d..7d28e7bb20 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -16,6 +16,23 @@
## Purpose
+### Removal refusals distinguish retained files from running services
+
+A missing saved URL with collector credentials refuses before stopping or
+disabling services, and says so. Failure to confirm server removal occurs after
+the applicable service stop/disable steps; its error must retain that ordering,
+state that retained credentials/service files do not establish running
+monitoring, and disclose that no automatic restart was attempted. Recovery
+requires trusted connectivity and reconciliation of the same-instance record
+and stopped/disabled service state before another removal attempt.
+
+The existing Unix state fixture checks both refusal stages without changing
+its synthetic files. `TestAgentInstalledRemovalSavedTransport` exercises the
+late error through the real collector CLI and TLS, preserving saved CA/pin,
+exact identity, credential bytes/modes and confined files on every refusal.
+Service/process observations remain doubles, not native or reporter recovery.
+No restart, erasure, trust or lifecycle ordering policy changes with this error.
+
### Unix agent preflight does not require character-class-aware NAS utilities
Installer case-folding uses fixed ASCII alphabets, and whitespace handling uses
diff --git a/scripts/install.sh b/scripts/install.sh
index 9a52fb07e6..e9697a470f 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -6548,7 +6548,7 @@ if [[ "$UNINSTALL" == "true" ]]; then
if collector_credential_state_present; then
uninstall_has_credential="true"
if [[ -z "$PULSE_URL" ]]; then
- fail "The saved Pulse URL is missing; local credentials and services were retained. Restore saved connection state or provide --url for the same trusted Pulse instance and retry uninstall." "$EXIT_MISSING_ARGS"
+ fail "The saved Pulse URL is missing; local credentials and service files were retained. No service stop or disable was attempted. Restore saved connection state or provide --url for the same trusted Pulse instance before retrying uninstall." "$EXIT_MISSING_ARGS"
fi
fi
uninstall_nas_platform=$(nas_agent_removal_platform || true)
@@ -6608,7 +6608,7 @@ if [[ "$UNINSTALL" == "true" ]]; then
if [[ "$uninstall_has_credential" == "true" ]]; then
log_info "Authenticating Pulse server removal before local teardown..."
if ! uninstall_collector_registration; then
- fail "Pulse did not durably confirm collector removal; local credentials and services were retained. Restore trusted server connectivity and retry uninstall." "$EXIT_GENERAL"
+ fail "Pulse did not durably confirm collector removal; local credentials and service files were retained. Service stop/disable steps have already run where applicable; retained files do not mean monitoring is running. No automatic restart was attempted. Restore trusted server connectivity and reconcile the same-instance registration and stopped/disabled service state before retrying uninstall." "$EXIT_GENERAL"
fi
log_info "Pulse durably removed agent ID: ${AGENT_ID}."
elif [[ -n "$PULSE_URL" ]]; then
diff --git a/scripts/installtests/agent_installed_removal_transport_test.go b/scripts/installtests/agent_installed_removal_transport_test.go
index 4d88023a6d..13c0bdd5aa 100644
--- a/scripts/installtests/agent_installed_removal_transport_test.go
+++ b/scripts/installtests/agent_installed_removal_transport_test.go
@@ -198,9 +198,25 @@ rm() {
} else {
// Quiescence may already have stopped and disabled services. It
// is not rolled back or described as an unchanged installation.
- if string(events) != "quiesce\n" || !strings.Contains(string(out), "local credentials and services were retained") {
+ if string(events) != "quiesce\n" {
t.Fatalf("unconfirmed removal proceeded to erasure: %s\n%s", events, out)
}
+ for _, fact := range []string{
+ "local credentials and service files were retained",
+ "Service stop/disable steps have already run where applicable",
+ "retained files do not mean monitoring is running",
+ "No automatic restart was attempted",
+ "Restore trusted server connectivity",
+ "same-instance registration and stopped/disabled service state before retrying",
+ } {
+ if !strings.Contains(string(out), fact) {
+ t.Fatalf("unconfirmed removal omitted recovery fact %q:\n%s", fact, out)
+ }
+ }
+ if strings.Contains(string(out), "No service stop or disable was attempted") ||
+ strings.Contains(string(out), "credentials and services were retained") {
+ t.Fatalf("unconfirmed removal misrepresented service state:\n%s", out)
+ }
for name, want := range saved {
path := filepath.Join(state, name)
got, err := os.ReadFile(path)
diff --git a/scripts/installtests/agent_uninstall_state.py b/scripts/installtests/agent_uninstall_state.py
index 725ac2b4c4..e5d2008eff 100644
--- a/scripts/installtests/agent_uninstall_state.py
+++ b/scripts/installtests/agent_uninstall_state.py
@@ -186,6 +186,9 @@ rm() {
result, events, before, after = self.exercise(kind)
self.assertEqual(result.returncode, 16, result.stderr)
self.assertIn("same trusted Pulse instance", result.stdout)
+ self.assertIn("No service stop or disable was attempted", result.stdout)
+ self.assertIn("local credentials and service files were retained", result.stdout)
+ self.assertNotIn("Service stop/disable steps have already run", result.stdout)
self.assertNotIn("synthetic-collector-credential", result.stdout + result.stderr)
self.assertEqual(events, "")
self.assertEqual(after, before)
@@ -197,6 +200,14 @@ rm() {
self.assertEqual(result.returncode, 1, result.stderr)
self.assertEqual(events, "request:collector-uninstall --agent-id owned-agent --hostname owned-host\n")
self.assertEqual(after, before)
+ for fact in ("Service stop/disable steps have already run where applicable",
+ "retained files do not mean monitoring is running",
+ "No automatic restart was attempted",
+ "Restore trusted server connectivity",
+ "same-instance registration and stopped/disabled service state before retrying"):
+ self.assertIn(fact, result.stdout)
+ self.assertNotIn("No service stop or disable was attempted", result.stdout)
+ self.assertNotIn("credentials and services were retained", result.stdout)
def test_systemd_refusal_precedes_remote_removal_and_every_local_mutation(self):
for credential in ("runtime", "inline", "none"):
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 0cf519524f..9cd2a04321 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -5399,7 +5399,7 @@ func TestInstallSHOfflineInstallerAndUninstallUseAuthenticatedLifecycleTransport
`verify_download_signature "$installer_tmp" "$installer_signature"`,
`collector-uninstall`,
`run_collector_lifecycle_command "${uninstall_args[@]}"`,
- `Pulse did not durably confirm collector removal; local credentials and services were retained.`,
+ `Pulse did not durably confirm collector removal; local credentials and service files were retained.`,
} {
if !strings.Contains(script, required) {
t.Fatalf("installer lifecycle transport contract missing %q", required)
diff --git a/scripts/tests/test_agent_uninstall_docs.py b/scripts/tests/test_agent_uninstall_docs.py
index 100b97930f..a26c18d347 100644
--- a/scripts/tests/test_agent_uninstall_docs.py
+++ b/scripts/tests/test_agent_uninstall_docs.py
@@ -176,7 +176,8 @@ class AgentUninstallDocsTest(unittest.TestCase):
# Bind the help to production admission, not a hypothetical policy.
admission = self.removal.split("if collector_credential_state_present; then", 1)[1]
missing_url = admission.split('if [[ -z "$PULSE_URL" ]]; then', 1)[1].split("\n fi", 1)[0]
- self.assertIn("local credentials and services were retained", missing_url)
+ self.assertIn("local credentials and service files were retained", missing_url)
+ self.assertIn("No service stop or disable was attempted", missing_url)
self.assertIn("same trusted Pulse instance", missing_url)
self.assertLess(admission.index("uninstall_collector_registration"),
admission.index("teardown_action_runner_service"))