Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport/2.8/56703 #56829

Merged
merged 2 commits into from May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/56734-postgres_bugfix_pg_restore.yml
@@ -0,0 +1,2 @@
bugfixes:
- postgresql_db - fix for postgresql_db fails if stderr contains output (https://github.com/ansible/ansible/issues/56703)
11 changes: 2 additions & 9 deletions lib/ansible/modules/database/postgresql/postgresql_db.py
Expand Up @@ -539,16 +539,9 @@ def main():
try:
rc, stdout, stderr, cmd = method(module, target, target_opts, db, **kw)
if rc != 0:
module.fail_json(msg='Dump of database %s failed' % db,
stdout=stdout, stderr=stderr, rc=rc, cmd=cmd)

elif stderr and 'warning' not in str(stderr):
module.fail_json(msg='Dump of database %s failed' % db,
stdout=stdout, stderr=stderr, rc=1, cmd=cmd)

module.fail_json(msg=stderr, stdout=stdout, rc=rc, cmd=cmd)
else:
module.exit_json(changed=True, msg='Dump of database %s has been done' % db,
stdout=stdout, stderr=stderr, rc=rc, cmd=cmd)
module.exit_json(changed=True, msg=stdout, stderr=stderr, rc=rc, cmd=cmd)
except SQLParseError as e:
module.fail_json(msg=to_native(e), exception=traceback.format_exc())

Expand Down