mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Merge pull request #124 from zalando/bugfix/wrong-username
Bugfix: Ensure to inject the superuser username when connecting.
This commit is contained in:
@@ -131,6 +131,7 @@ class Postgresql:
|
||||
def connection(self):
|
||||
if not self._connection or self._connection.closed != 0:
|
||||
r = parseurl('postgres://{}/postgres'.format(self.local_address))
|
||||
r.update(self.superuser)
|
||||
self._connection = psycopg2.connect(**r)
|
||||
self._connection.autocommit = True
|
||||
self.server_version = self._connection.server_version
|
||||
@@ -138,7 +139,7 @@ class Postgresql:
|
||||
|
||||
def _cursor(self):
|
||||
if not self._cursor_holder or self._cursor_holder.closed or self._cursor_holder.connection.closed != 0:
|
||||
logger.info("established a new patroni connection to the postgres cluster")
|
||||
logger.info("establishing a new patroni connection to the postgres cluster")
|
||||
self._cursor_holder = self.connection().cursor()
|
||||
return self._cursor_holder
|
||||
|
||||
|
||||
Reference in New Issue
Block a user