Pass the PostgreSQL "PGSSLMODE" environment variable through to Borg (#370).
This commit is contained in:
parent
ad1d104d65
commit
75d11aa9cd
3 changed files with 15 additions and 3 deletions
2
NEWS
2
NEWS
|
@ -1,4 +1,6 @@
|
||||||
1.8.8.dev0
|
1.8.8.dev0
|
||||||
|
* #370: For the PostgreSQL hook, pass the "PGSSLMODE" environment variable through to Borg when the
|
||||||
|
database's configuration omits the "ssl_mode" option.
|
||||||
* #818: Allow the "--repository" flag to match across multiple configuration files.
|
* #818: Allow the "--repository" flag to match across multiple configuration files.
|
||||||
* #820: Fix broken repository detection in the "rcreate" action with Borg 1.4. The issue did not
|
* #820: Fix broken repository detection in the "rcreate" action with Borg 1.4. The issue did not
|
||||||
occur with other versions of Borg.
|
occur with other versions of Borg.
|
||||||
|
|
|
@ -25,8 +25,8 @@ def make_dump_path(config): # pragma: no cover
|
||||||
|
|
||||||
def make_extra_environment(database, restore_connection_params=None):
|
def make_extra_environment(database, restore_connection_params=None):
|
||||||
'''
|
'''
|
||||||
Make the extra_environment dict from the given database configuration.
|
Make the extra_environment dict from the given database configuration. If restore connection
|
||||||
If restore connection params are given, this is for a restore operation.
|
params are given, this is for a restore operation.
|
||||||
'''
|
'''
|
||||||
extra = dict()
|
extra = dict()
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ def make_extra_environment(database, restore_connection_params=None):
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
extra['PGSSLMODE'] = database.get('ssl_mode', 'disable')
|
if 'ssl_mode' in database:
|
||||||
|
extra['PGSSLMODE'] = database['ssl_mode']
|
||||||
if 'ssl_cert' in database:
|
if 'ssl_cert' in database:
|
||||||
extra['PGSSLCERT'] = database['ssl_cert']
|
extra['PGSSLCERT'] = database['ssl_cert']
|
||||||
if 'ssl_key' in database:
|
if 'ssl_key' in database:
|
||||||
|
@ -49,6 +50,7 @@ def make_extra_environment(database, restore_connection_params=None):
|
||||||
extra['PGSSLROOTCERT'] = database['ssl_root_cert']
|
extra['PGSSLROOTCERT'] = database['ssl_root_cert']
|
||||||
if 'ssl_crl' in database:
|
if 'ssl_crl' in database:
|
||||||
extra['PGSSLCRL'] = database['ssl_crl']
|
extra['PGSSLCRL'] = database['ssl_crl']
|
||||||
|
|
||||||
return extra
|
return extra
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,14 @@ def test_make_extra_environment_without_cli_password_or_configured_password_does
|
||||||
assert 'PGPASSWORD' not in extra
|
assert 'PGPASSWORD' not in extra
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_extra_environment_without_ssl_mode_does_not_set_ssl_mode():
|
||||||
|
database = {'name': 'foo'}
|
||||||
|
|
||||||
|
extra = module.make_extra_environment(database)
|
||||||
|
|
||||||
|
assert 'PGSSLMODE' not in extra
|
||||||
|
|
||||||
|
|
||||||
def test_database_names_to_dump_passes_through_individual_database_name():
|
def test_database_names_to_dump_passes_through_individual_database_name():
|
||||||
database = {'name': 'foo'}
|
database = {'name': 'foo'}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue