playbooks/remove-autorestic: use a glob for unit removal (YAML folded the backslash continuation)

The previous version listed four unit paths separated by `\` + newline.
That looks fine in source but YAML plain-scalar folding collapses the
sequence to a literal `\ ` — the backslash + space no longer functions
as a shell line continuation, and only the first path actually gets
passed to rm. End result on esh-docker-vm's first run: backup.service
removed; backup.timer + prune.service + prune.timer survived; verify
correctly caught the partial state.

Switched to `rm -f /etc/systemd/system/autorestic-*.{service,timer}`
form — single string, no folding hazard, and idempotent on hosts where
some or all of the files are already gone. Re-running on esh-docker-vm
will mop up the leftovers cleanly.
This commit is contained in:
2026-04-26 14:39:41 -07:00
parent ac282c5526
commit 52fcbe4cd6
+6 -5
View File
@@ -51,12 +51,13 @@ steps:
sudo: true
- name: Remove autorestic systemd unit files
shell: rm -f /etc/systemd/system/autorestic-backup.service \
/etc/systemd/system/autorestic-backup.timer \
/etc/systemd/system/autorestic-prune.service \
/etc/systemd/system/autorestic-prune.timer
# Glob, not a list of explicit paths. A previous version used
# `rm -f path1 \` + newline + `path2`, which gets bitten by YAML
# plain-scalar folding: the backslash + newline collapses to a
# literal `\ ` and only the first path gets removed. The glob is
# also idempotent on hosts where the files are already gone.
shell: rm -f /etc/systemd/system/autorestic-*.service /etc/systemd/system/autorestic-*.timer
sudo: true
removes: /etc/systemd/system/autorestic-backup.timer
- name: systemctl daemon-reload (drop the removed units from systemd's view)
shell: systemctl daemon-reload