From 8389851f2f907164713a621240b4e0f6e2e66663 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 15 Jun 2023 23:34:50 +0530 Subject: [PATCH] fix bug where port becomes truthy when none is converted to str --- borgmatic/hooks/mongodb.py | 2 +- borgmatic/hooks/mysql.py | 2 +- borgmatic/hooks/postgresql.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/borgmatic/hooks/mongodb.py b/borgmatic/hooks/mongodb.py index 1cbd98f..f8432b1 100644 --- a/borgmatic/hooks/mongodb.py +++ b/borgmatic/hooks/mongodb.py @@ -143,7 +143,7 @@ def build_restore_command(extract_process, database, dump_filename, connection_p Return the mongorestore command from a single database configuration. ''' hostname = connection_params['hostname'] or database.get('restore_hostname', database.get('hostname')) - port = str(connection_params['port'] or database.get('restore_port', database.get('port'))) + port = str(connection_params['port'] or database.get('restore_port', database.get('port', ''))) username = connection_params['username'] or database.get('restore_username', database.get('username')) password = connection_params['password'] or database.get('restore_password', database.get('password')) diff --git a/borgmatic/hooks/mysql.py b/borgmatic/hooks/mysql.py index b5218dc..f64f16f 100644 --- a/borgmatic/hooks/mysql.py +++ b/borgmatic/hooks/mysql.py @@ -201,7 +201,7 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run, database = database_config[0] hostname = connection_params['hostname'] or database.get('restore_hostname', database.get('hostname')) - port = str(connection_params['port'] or database.get('restore_port', database.get('port'))) + port = str(connection_params['port'] or database.get('restore_port', database.get('port', ''))) username = connection_params['username'] or database.get('restore_username', database.get('username')) password = connection_params['password'] or database.get('restore_password', database.get('password')) diff --git a/borgmatic/hooks/postgresql.py b/borgmatic/hooks/postgresql.py index 8672028..08b0019 100644 --- a/borgmatic/hooks/postgresql.py +++ b/borgmatic/hooks/postgresql.py @@ -222,7 +222,7 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run, database = database_config[0] hostname = connection_params['hostname'] or database.get('restore_hostname', database.get('hostname')) - port = str(connection_params['port'] or database.get('restore_port', database.get('port'))) + port = str(connection_params['port'] or database.get('restore_port', database.get('port', ''))) username = connection_params['username'] or database.get('restore_username', database.get('username')) all_databases = bool(database['name'] == 'all')