From 731bf1b11ddd86b0801560d4533ae39cb8dadb5a Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Mon, 26 Nov 2018 13:08:03 +0900 Subject: [PATCH] Fix issue #39412 (#39483) * postgresql_db dump does not fail on FATAL error when using compression --- lib/ansible/modules/database/postgresql/postgresql_db.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index 9d6df4a98ea..e29e5d65bc7 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -460,6 +460,9 @@ def main(): module.fail_json(msg=to_native(e), exception=traceback.format_exc()) elif state in ("dump", "restore"): + if not db_exists(cursor, db) and state == "dump": + module.fail_json( + msg="database \"{db}\" does not exist".format(db=db)) method = state == "dump" and db_dump or db_restore try: rc, stdout, stderr, cmd = method(module, target, target_opts, db, **kw)