Added 'hostaddr' and used host string as it is while creating SSHTunnel.

This commit is contained in:
Akshay Joshi 2023-10-12 17:57:40 +05:30
parent 3a62fc5a2a
commit 81dcc91747

View File

@ -652,14 +652,15 @@ WHERE db.oid = {0}""".format(did))
parameters. parameters.
""" """
dsn_args = dict() dsn_args = dict()
dsn_args['host'] = \ dsn_args['host'] = self.host
self.local_bind_host if self.use_ssh_tunnel else self.host
dsn_args['port'] = \ dsn_args['port'] = \
self.local_bind_port if self.use_ssh_tunnel else self.port self.local_bind_port if self.use_ssh_tunnel else self.port
dsn_args['dbname'] = database dsn_args['dbname'] = database
dsn_args['user'] = user dsn_args['user'] = user
if self.service is not None: if self.service is not None:
dsn_args['service'] = self.service dsn_args['service'] = self.service
if self.use_ssh_tunnel:
dsn_args['hostaddr'] = self.local_bind_host
# Make a copy to display the connection string on GUI. # Make a copy to display the connection string on GUI.
display_dsn_args = dsn_args.copy() display_dsn_args = dsn_args.copy()
@ -680,10 +681,9 @@ WHERE db.oid = {0}""".format(did))
with_complete_path = True with_complete_path = True
value = get_complete_file_path(value) value = get_complete_file_path(value)
# In case of host address need to check ssh tunnel flag. # If key is hostaddr and ssh tunnel is in use don't overwrite.
if key == 'hostaddr': if key == 'hostaddr' and self.use_ssh_tunnel:
value = self.local_bind_host if self.use_ssh_tunnel else \ continue
value
dsn_args[key] = value dsn_args[key] = value
display_dsn_args[key] = orig_value if with_complete_path else \ display_dsn_args[key] = orig_value if with_complete_path else \