Red Hat Bugzilla – Bug 964333
rhn-satellite-activate --disconnect fails because driver_postgresql.py sets host=None instead of host=localhost
Last modified: 2017-09-28 14:08:00 EDT
Description of problem:
In my postgresq DB I have "ident" as auth method when using Unix sockets and "md5" for anything else. In this scenario, rhn-satellite-activate will fail because /usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py has the following code:
""" Class for PostgreSQL database operations. """
def __init__(self, host=None, port=None, username=None,
if host is None or host == '' or host == 'localhost':
self.host = None
self.port = None
self.host = host
self.port = port
I have host = localhost in /etc/rhn/rhn.conf and the above will try to connect without having set 'host' to anything and the connect will fail due to wrong auth:
init.py:179:connect:SQLConnectError: (None, None, 'spacewalk', 'Attempting Re-Connect to the database failed')
Traceback (most recent call last):
File "/usr/bin/rhn-satellite-activate", line 42, in <module>
sys.exit(abs(mod.main() or 0))
File "/usr/lib/python2.7/site-packages/spacewalk/satellite_tools/rhn_satellite_activate.py", line 580, in main
File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/init.py", line 102, in initDB
initDB(backend, host, port, username, password, database)
File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/init.py", line 55, in initDB
File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 174, in connect
File "/usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 163, in connect
File "/usr/lib64/python2.7/site-packages/psycopg2/init.py", line 179, in connect
SQLConnectError: (None, None, 'spacewalk', 'Attempting Re-Connect to the database failed')
If I change the line "if host is None or host == '' or host == 'localhost':"
to " if host is None or host == ''": things are fine.
Version-Release number of selected component (if applicable):
# rpm -qf /usr/lib/python2.7/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py
(In reply to comment #0)
> Description of problem:
> In my postgresq DB I have "ident" as auth method when using Unix sockets and
You PostgreSQL setup is incorrect then -- please consult
for the settings that work with Spacewalk.
This BZ closed some time during 2.5, 2.6 or 2.7. Adding to 2.7 tracking bug.