Skip to content

Commit

Permalink
Trim primary connection from new parameters
Browse files Browse the repository at this point in the history
Fixes:

    : invalid dsn: invalid connection option "ssl_min_protocol_version"
    : Traceback (most recent call last):
    :   File "/usr/local/src/temboard-agent/temboardagent/plugins/monitoring/probes.py", line 793, in run
    :     dsn, connection_factory=PhysicalReplicationConnection
    :   File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 129, in connect
    :     dsn = _ext.make_dsn(dsn, **kwargs)
    :   File "/usr/local/lib/python3.6/site-packages/psycopg2/extensions.py", line 155, in make_dsn
    :     parse_dsn(dsn)
    : psycopg2.ProgrammingError: invalid dsn: invalid connection option "ssl_min_protocol_version"
  • Loading branch information
bersace committed Feb 4, 2022
1 parent c084135 commit 3786fdd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions temboardagent/plugins/monitoring/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ def parse_primary_conninfo(pci):
c = m.group(1).replace("''", "'")
c = c.replace("\\'", "'")

# Keep only compat parameters because we may be bound to an old libpq.
well_known_params = [
p for p in c.split() if (
p.startswith('user') or
p.startswith('password') or
p.startswith('host') or
p.startswith('port') or
p.startswith('sslmode')
)
]

c = ' '.join(well_known_params)

return c


Expand Down

0 comments on commit 3786fdd

Please sign in to comment.