Skip to content

Commit

Permalink
Fixed an issue where Import Export not working when using pgpassfile. #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevapo authored Jun 29, 2023
1 parent cbeacf8 commit 944b614
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/pgadmin/tools/import_export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \
fs_short_path, document_dir, IS_WIN, does_utility_exist, \
filename_with_file_manager_path
filename_with_file_manager_path, get_complete_file_path
from pgadmin.utils.ajax import make_json_response, bad_request, unauthorized

from config import PG_DEFAULT_DRIVER
Expand Down Expand Up @@ -56,6 +56,7 @@ class IEMessage(IProcessDesc):
Defines the message shown for the import/export operation.
"""

def __init__(self, *_args, **io_params):
self.sid = io_params['sid']
self.schema = io_params['schema']
Expand Down Expand Up @@ -102,7 +103,7 @@ def get_server_name(self):
host_port_str = ''
if s.host:
host_port_str = '({0}:{1})'.format(
s.host, s.port)if s.port else '{0}'.format(s.host)
s.host, s.port) if s.port else '{0}'.format(s.host)

return "{0} {1}".format(s.name, host_port_str)

Expand Down Expand Up @@ -349,6 +350,14 @@ def create_import_export_job(sid):
if value is None:
del env[key]

# Export PGPASSFILE to work with PGPASSFILE authenthification
if manager.connection_params \
and isinstance(manager.connection_params, dict):
if 'passfile' in manager.connection_params \
and manager.connection_params['passfile']:
env['PGPASSFILE'] = get_complete_file_path(
manager.connection_params['passfile'])

p.set_env_variables(server, env=env)
p.start()
jid = p.id
Expand Down

0 comments on commit 944b614

Please sign in to comment.