From f05f146c0ca1cf768ad0907805da7f55b73add63 Mon Sep 17 00:00:00 2001 From: James Marshall Date: Tue, 25 Aug 2026 14:55:36 -0400 Subject: [PATCH] fix: preserve backup_dir on finalizer path for clean_backup_on_delete Same regression as automationcontroller-operator: postgres_skip_data moved backup_dir/timestamp setup into init.yml, which finalizer.yml also runs on CR deletion. set_fact overwrote the block-scoped backup_dir from CR status, so the wrong (empty) directory got deleted instead of the real backup. Guard the three init.yml tasks with `when: not finalizer_run | bool`, consistent with main.yml's existing finalizer_run branching. Assisted by: Claude Signed-off-by: James Marshall --- roles/backup/tasks/init.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/backup/tasks/init.yml b/roles/backup/tasks/init.yml index 63272967..ef836b3c 100644 --- a/roles/backup/tasks/init.yml +++ b/roles/backup/tasks/init.yml @@ -97,10 +97,12 @@ - name: Determine the timestamp for the backup once for all nodes set_fact: now: '{{ lookup("pipe", "date +%F-%T") }}' + when: not finalizer_run | bool - name: Set backup directory name set_fact: backup_dir: "/backups/eda-openshift-backup-{{ now }}" + when: not finalizer_run | bool - name: Create directory for backup k8s_exec: @@ -108,3 +110,4 @@ pod: "{{ ansible_operator_meta.name }}-db-management" command: >- mkdir -p {{ backup_dir }} + when: not finalizer_run | bool