From fd39f54df7b44cdc90cbae41bbced3e7555898be Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 18 Nov 2022 08:35:01 -0800 Subject: [PATCH] Code formatting. --- NEWS | 1 + borgmatic/hooks/postgresql.py | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index c8164cf..1be4956 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ 1.7.5.dev0 + * #311: Override PostgreSQL dump/restore commands via configuration options. * #604: Fix traceback when a configuration section is present but lacking any options. * #607: Clarify examples in include merging and deep merging documentation. * #611: Fix "data" consistency check to support "check_last" and consistency "prefix" options. diff --git a/borgmatic/hooks/postgresql.py b/borgmatic/hooks/postgresql.py index c40e62c..6a0ac69 100644 --- a/borgmatic/hooks/postgresql.py +++ b/borgmatic/hooks/postgresql.py @@ -59,12 +59,7 @@ def dump_databases(databases, log_prefix, location_config, dry_run): default_dump_command = 'pg_dumpall' if all_databases else 'pg_dump' dump_command = database.get('pg_dump_command') or default_dump_command command = ( - ( - dump_command, - '--no-password', - '--clean', - '--if-exists', - ) + (dump_command, '--no-password', '--clean', '--if-exists',) + (('--host', database['hostname']) if 'hostname' in database else ()) + (('--port', str(database['port'])) if 'port' in database else ()) + (('--username', database['username']) if 'username' in database else ())