Skip to content

Commit 384d203

Browse files
postgresql_db: fix restoring from SQL files would execute the file twice (#883) (#902)
(cherry picked from commit d1a2fbc) Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
1 parent bb3e94f commit 384d203

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- postgresql_db - restoring from ``.sql`` files would execute the file twice. The module now avoids using both ``--file`` and stdin redirection simultaneously (https://github.com/ansible-collections/community.postgresql/issues/882).

plugins/modules/postgresql_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def db_restore(module, target, target_opts="",
634634
else:
635635
if any(substring in cmd for substring in ['--format=Directory', '--format=Custom']):
636636
cmd = '{0} {1}'.format(cmd, shlex_quote(target))
637-
else:
637+
elif '--file=' not in cmd:
638638
cmd = '{0} < {1}'.format(cmd, shlex_quote(target))
639639

640640
return do_with_password(module, cmd, password)

0 commit comments

Comments
 (0)