Skip to content

Commit

Permalink
Restore custom format as file instead of using stdin (#681) (#683)
Browse files Browse the repository at this point in the history
* Restore custom format as file insted of using stdin

* add changelog

* fix linting

* fix line ending

* fix typo

(cherry picked from commit 1d206c8)

Co-authored-by: matiasba <[email protected]>
  • Loading branch information
patchback[bot] and matiasba authored Mar 4, 2024
1 parent e9fc7ee commit d184532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/681-restore-custom-format-as-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- postgresql_db - ``restore`` custom format as file instead of stdin to allow the use of --job
flag in ``target_opts`` (https://github.com/ansible-collections/community.postgresql/issues/594).
2 changes: 1 addition & 1 deletion plugins/modules/postgresql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def db_restore(module, target, target_opts="",
else:
return p2.returncode, '', stderr2, 'cmd: ****'
else:
if '--format=Directory' in cmd:
if any(substring in cmd for substring in ['--format=Directory', '--format=Custom']):
cmd = '{0} {1}'.format(cmd, shlex_quote(target))
else:
cmd = '{0} < {1}'.format(cmd, shlex_quote(target))
Expand Down

0 comments on commit d184532

Please sign in to comment.