From 52fcbe4cd666f9b8c9c3e669746e84ad2933763b Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Sun, 26 Apr 2026 14:39:41 -0700 Subject: [PATCH] playbooks/remove-autorestic: use a glob for unit removal (YAML folded the backslash continuation) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- playbooks/remove-autorestic.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/playbooks/remove-autorestic.yaml b/playbooks/remove-autorestic.yaml index fc613e9..8545c2b 100644 --- a/playbooks/remove-autorestic.yaml +++ b/playbooks/remove-autorestic.yaml @@ -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