Ensure backup/restore/maintenance works with invalid pgpass file parameter. #6820

This commit is contained in:
Yogesh Mahajan 2023-11-06 18:02:52 +05:30 committed by GitHub
parent 695c008245
commit 0d8adf9ced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,6 +309,8 @@ class BatchProcess:
if self.env:
env.update(self.env)
current_app.logger.debug(self.env)
if cb is not None:
cb(env)
if os.name == 'nt':
@ -839,8 +841,10 @@ class BatchProcess:
isinstance(self.manager_obj.connection_params, dict) and \
'passfile' in self.manager_obj.connection_params and \
self.manager_obj.connection_params['passfile']:
self.env['PGPASSFILE'] = get_complete_file_path(
pgpasspath = get_complete_file_path(
self.manager_obj.connection_params['passfile'])
if pgpasspath is not None:
self.env['PGPASSFILE'] = pgpasspath
# Check for connection timeout and if it is greater than 0 then
# set the environment variable PGCONNECT_TIMEOUT.