From f0f43174c6be21157d2d30955e14f04ddcead8a2 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Fri, 14 Apr 2023 16:29:26 +0200 Subject: [PATCH] Swap if-else in restore_database_dump in postgresql hook for cleanliness --- borgmatic/hooks/postgresql.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/borgmatic/hooks/postgresql.py b/borgmatic/hooks/postgresql.py index b91b97b8b..0f1a2df42 100644 --- a/borgmatic/hooks/postgresql.py +++ b/borgmatic/hooks/postgresql.py @@ -221,9 +221,9 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run, tuple(psql_command if all_databases else pg_restore_command) + ('--no-password',) + ( - ('--if-exists', '--exit-on-error', '--clean', '--dbname', database['name']) - if not all_databases - else ('--no-psqlrc', '--set', 'ON_ERROR_STOP=on') + ('--no-psqlrc', '--set', 'ON_ERROR_STOP=on') + if all_databases + else ('--if-exists', '--exit-on-error', '--clean', '--dbname', database['name']) ) + (('--host', database['hostname']) if 'hostname' in database else ()) + (('--port', str(database['port'])) if 'port' in database else ())