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.

Give DSM manual temporaries to the existing installer EXIT cleanup

pulse-triage[bot]da597d34d6e3
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index a6ead91181..e5bbd51632 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -36,7 +36,9 @@ is still absent, leaving the manual override and all local recovery state;
atomic non-replacement links refuse concurrently created files or directories,
including during restore; the staged recovery copy is retained on conflict.
Override write, permission and link operations each have explicit checked
-failure handling and remove only their owned non-credential temporary file. Only confirmed retirement removes the staged config and manual
+failure handling. Their non-credential temporary is also registered with the
+existing installer EXIT cleanup, executed by the production-function controls.
+Credential-bearing staged job recovery is never registered for EXIT deletion. Only confirmed retirement removes the staged config and manual
before credential/state erasure. No credentials, arguments or config contents
are returned by these observations. Existing same-instance URL, exact record,
TLS, systemd/OpenRC/rc.d/SysV and state-directory ownership remain unchanged.
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index f5848e8bd8..8320297255 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -37,7 +37,9 @@ is still absent, leaving the manual override and all local recovery state;
atomic non-replacement links refuse concurrently created files or directories,
including during restore; the staged recovery copy is retained on conflict.
Override write, permission and link operations each have explicit checked
-failure handling and remove only their owned non-credential temporary file. Only confirmed retirement removes the staged config and manual
+failure handling. Their non-credential temporary is also registered with the
+existing installer EXIT cleanup, executed by the production-function controls.
+Credential-bearing staged job recovery is never registered for EXIT deletion. Only confirmed retirement removes the staged config and manual
before credential/state erasure. No credentials, arguments or config contents
are returned by these observations. Existing same-instance URL, exact record,
TLS, systemd/OpenRC/rc.d/SysV and state-directory ownership remain unchanged.
diff --git a/scripts/install.sh b/scripts/install.sh
index 1b23e07aac..543578ece3 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1620,6 +1620,9 @@ quiesce_upstart_agent_for_removal() {
else legacy_agent_processes_absent "$inventory" && return 1; fi
if [[ ! -e "$override" ]]; then
pending=$(mktemp "${override}.XXXXXX") || return 1
+ # The existing installer EXIT trap also owns this non-credential
+ # temporary if a command failure exits before inline cleanup.
+ TMP_FILES+=("$pending")
# Link without replacement: an override created concurrently is not
# ours to overwrite. The temporary file contains no credential.
if ! printf 'manual\n' > "$pending"; then
diff --git a/scripts/installtests/agent_upstart_teardown.py b/scripts/installtests/agent_upstart_teardown.py
index 25175d1b8d..376a405435 100644
--- a/scripts/installtests/agent_upstart_teardown.py
+++ b/scripts/installtests/agent_upstart_teardown.py
@@ -16,7 +16,7 @@ import unittest
ROOT = Path(__file__).resolve().parents[2]
SOURCE = Path(os.environ.get("PULSE_AGENT_UPSTART_SOURCE", ROOT / "scripts/install.sh"))
-FUNCTIONS = ("portable_path_uid", "portable_path_mode", "trusted_lifecycle_regular_file",
+FUNCTIONS = ("cleanup", "portable_path_uid", "portable_path_mode", "trusted_lifecycle_regular_file",
"read_legacy_agent_removal_processes", "legacy_agent_processes_absent",
"read_upstart_agent_removal_status", "upstart_agent_removal_paths_safe",
"read_upstart_agent_removal_enablement", "quiesce_upstart_agent_for_removal",
@@ -164,6 +164,7 @@ class AgentUpstartTeardown(unittest.TestCase):
setup = "\n".join(k + "=" + shlex.quote(str(v)) for k, v in values.items()) + "\n"
shell = r'''
set -euo pipefail
+TMP_FILES=()
UNINSTALL=true AGENT_NAME=pulse-agent BINARY_NAME=pulse-agent INSTALL_DIR=/usr/local/bin
EXIT_GENERAL=1 EXIT_MISSING_ARGS=16 PULSE_URL=https://same-instance.example.invalid AGENT_ID=synthetic
ACTION_RUNNER_NAME=pulse-agent-runner PRIVILEGED_HELPER_NAME=pulse-agent-helper
@@ -236,6 +237,7 @@ remove_safe_profile_state_dir() { builtin command rm -r -- "$SAFE_PROFILE_STATE_
invoke = "read_upstart_agent_removal_status\n"
else:
invoke = ("teardown_upstart_agent_service\n") * (2 if repeat else 1)
+ invoke = "trap cleanup EXIT\n" + invoke
env = dict(os.environ, PATH=str(tools) + ":" + os.environ["PATH"], FIXTURE=str(root))
result = subprocess.run(["bash", "-c", setup + shell + redirect(definitions(self.source)) + invoke],
cwd=root, env=env, text=True, capture_output=True, timeout=15)
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 5053a551d5..490b04be73 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -8473,7 +8473,7 @@ func TestInstallSHUpstartTeardownRequiresObservedQuiescence(t *testing.T) {
cmd := exec.CommandContext(ctx, "python3", repoFile("scripts", "installtests", "agent_upstart_teardown.py"))
output, err := cmd.CombinedOutput()
if err != nil {
- t.Fatalf("DSM Upstart retirement and owned temporary cleanup controls: %v\n%s", err, output)
+ t.Fatalf("DSM Upstart retirement and production EXIT cleanup controls: %v\n%s", err, output)
}
for _, name := range []string{
"test_refused_manager_precedes_remote_and_state_erasure",