From 5511f939a31f35fb5ce4c6387e171e47041e42aa Mon Sep 17 00:00:00 2001 From: "Christian M. Adams" Date: Mon, 8 Apr 2024 17:31:15 -0400 Subject: [PATCH] Fix bug when injecting override database_secret during backup --- roles/restore/tasks/secrets.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/restore/tasks/secrets.yml b/roles/restore/tasks/secrets.yml index f049d1cb..7bd0d5bf 100644 --- a/roles/restore/tasks/secrets.yml +++ b/roles/restore/tasks/secrets.yml @@ -32,11 +32,16 @@ set_fact: _generated_pg_secret_name: "{{ deployment_name }}-postgres-configuration" - - name: Override postgres_configuration_secret + - name: Set tmp database dict + set_fact: + _tmp_database: "{{ spec['database'] | combine({'database_secret': _generated_pg_secret_name}, recursive=True) }}" + no_log: "{{ no_log }}" + + - name: Override database_secret set_fact: spec: - "{{ spec | combine({'postgres_configuration_secret': _generated_pg_secret_name}, recursive=True) }}" - when: secrets['postgresConfigurationSecret']['data']['type'] | b64decode == 'managed' + "{{ spec | combine({'database': _tmp_database}, recursive=True) }}" + when: secrets['databaseConfigurationSecret']['data']['type'] | b64decode == 'managed' - name: If deployment is managed, set the database_host in the pg config secret block: