From f4badd4667d58654707c7aa55b0627660c8c1dae Mon Sep 17 00:00:00 2001 From: Adam Brokes Date: Wed, 13 Nov 2019 14:52:44 +1100 Subject: [PATCH 1/3] DCD-803: Ignore COMMENT ON EXTENSION errors when restoring to RDS --- roles/restore_backups/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/restore_backups/tasks/main.yml b/roles/restore_backups/tasks/main.yml index c1587bd..6b28bb1 100644 --- a/roles/restore_backups/tasks/main.yml +++ b/roles/restore_backups/tasks/main.yml @@ -97,6 +97,10 @@ # Depends on fetch_backup roles state: restore target: "{{ atl_backup_db_dest }}" + register: result + failed_when: + - result.rc != 0 + - "COMMENT ON EXTENSION" not in result.msg when: db_created.changed and atl_backup_db_dest is defined From a0496644d4c45b9c030e68a2bcb8a17826827f3f Mon Sep 17 00:00:00 2001 From: Adam Brokes Date: Wed, 13 Nov 2019 15:28:47 +1100 Subject: [PATCH 2/3] DCD-803: Quote the statement --- roles/restore_backups/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/restore_backups/tasks/main.yml b/roles/restore_backups/tasks/main.yml index 6b28bb1..5b752ff 100644 --- a/roles/restore_backups/tasks/main.yml +++ b/roles/restore_backups/tasks/main.yml @@ -100,7 +100,7 @@ register: result failed_when: - result.rc != 0 - - "COMMENT ON EXTENSION" not in result.msg + - '"COMMENT ON EXTENSION" not in result.msg' when: db_created.changed and atl_backup_db_dest is defined From c1486e14ecc9a13907a56c64f168027c159c04ed Mon Sep 17 00:00:00 2001 From: Adam Brokes Date: Wed, 13 Nov 2019 15:49:00 +1100 Subject: [PATCH 3/3] DCD-803: Add explaining comment --- roles/restore_backups/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/restore_backups/tasks/main.yml b/roles/restore_backups/tasks/main.yml index 5b752ff..1f9ebdb 100644 --- a/roles/restore_backups/tasks/main.yml +++ b/roles/restore_backups/tasks/main.yml @@ -98,6 +98,7 @@ state: restore target: "{{ atl_backup_db_dest }}" register: result + # managed DBs in cloud providers are not allowing full root access to the DB engine, we can safely ignore the COMMENT ON EXTENSION error failed_when: - result.rc != 0 - '"COMMENT ON EXTENSION" not in result.msg'