1
0
forked from Proxmox/ProxmoxVE

fix(pulse): keep the container recoverable when an update fails (#16311)

* fix(pulse): keep the container recoverable when an update fails

- Do not delete /opt/pulse/pulse before the download. CLEAN_INSTALL=1
  already wipes the target, so the rm only widened the failure window and
  destroyed the v5 binary when the fetch failed.
- Guard fetch_and_deploy_gh_release and restart the running installation
  when it fails, instead of exiting through the error handler with Pulse
  stopped.
- Re-enable the unit after the pulse-backend to pulse rename, but only if
  it was enabled before, so a deliberately disabled service stays that way.

* fix(pulse): roll back failed updates transactionally

* revert: keep Pulse update fix focused

---------

Co-authored-by: rcourtman <pulsemonitoringltd@gmail.com>
This commit is contained in:
rcourtman
2026-08-12 08:20:45 +01:00
committed by GitHub
parent 4bf3fda9c5
commit 4dfd7fcf2b
+16 -4
View File
@@ -35,22 +35,34 @@ function update_script() {
systemctl stop pulse*.service
msg_ok "Stopped Services"
if [[ -f /opt/pulse/pulse ]]; then
rm -f /opt/pulse/pulse
if ! CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pulse" "rcourtman/Pulse" "prebuild" "latest" "/opt/pulse" "pulse-v*-linux-$(arch_resolve).tar.gz"; then
msg_error "Download or deployment failed - check network connectivity and GitHub API availability"
if systemctl start pulse 2>/dev/null || systemctl start pulse-backend 2>/dev/null; then
msg_ok "Restarted the previously installed ${APP}"
else
msg_error "${APP} could not be restarted - reinstall it or restore the container from a backup"
fi
exit 250
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "pulse" "rcourtman/Pulse" "prebuild" "latest" "/opt/pulse" "pulse-v*-linux-$(arch_resolve).tar.gz"
ln -sf /opt/pulse/bin/pulse /usr/local/bin/pulse
mkdir -p /etc/pulse
chown pulse:pulse /etc/pulse
chown -R pulse:pulse /opt/pulse
chmod 700 /etc/pulse
UNIT_WAS_ENABLED=0
if [[ -f "$SERVICE_PATH"/pulse-backend.service ]]; then
if [[ $(systemctl is-enabled pulse-backend) == enabled ]]; then
UNIT_WAS_ENABLED=1
fi
systemctl disable -q pulse-backend.service 2>/dev/null || true
mv "$SERVICE_PATH"/pulse-backend.service "$SERVICE_PATH"/pulse.service
fi
sed -i -e 's|pulse/pulse|pulse/bin/pulse|' \
-e 's/^Environment="API.*$//' "$SERVICE_PATH"/pulse.service
systemctl daemon-reload
if [[ "$UNIT_WAS_ENABLED" == "1" ]]; then
systemctl enable -q pulse
fi
if grep -q 'pulse-home:/bin/bash' /etc/passwd; then
usermod -s /usr/sbin/nologin pulse
fi