Description of problem: taskotop cannot run when database is not running # db-control stop # taskotop Traceback (most recent call last): File "/usr/bin/taskotop", line 172, in <module> curses.wrapper(main) File "/usr/lib64/python2.6/curses/wrapper.py", line 43, in wrapper return func(stdscr, *args, **kwds) File "/usr/bin/taskotop", line 150, in main rhnSQL.initDB() File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/__init__.py", line 158, in initDB raise_with_tb(e, sys.exc_info()[2]) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/__init__.py", line 145, in initDB __init__DB(backend, host, port, username, password, database, sslmode, sslrootcert) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/__init__.py", line 57, in __init__DB __DB.connect() File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 195, in connect return self.connect(reconnect=reconnect - 1) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 200, in connect "All attempts to connect to the database failed"), sys.exc_info()[2]) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 185, in connect self.dbh = psycopg2.connect(" ".join("%s=%s" % (k, re.escape(str(v))) for k, v in dsndata.items())) spacewalk.server.rhnSQL.sql_base.SQLConnectError: (None, None, 'rhnschema', 'All attempts to connect to the database failed') and fails if you stop database when it runs # taskotop Traceback (most recent call last): File "/usr/bin/taskotop", line 172, in <module> curses.wrapper(main) File "/usr/lib64/python2.6/curses/wrapper.py", line 43, in wrapper return func(stdscr, *args, **kwds) File "/usr/bin/taskotop", line 162, in main [format_run(run) for run in get_tasko_runs(60)] File "/usr/bin/taskotop", line 47, in get_tasko_runs task_query.execute(timelimit = datetime.datetime.now() - datetime.timedelta(seconds=maximum_age)) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 151, in execute return self._execute_wrapper(self._execute, *p, **kw) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 296, in _execute_wrapper retval = function(*p, **kw) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 205, in _execute return self._execute_(args, kwargs) File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 318, in _execute_ self._real_cursor.execute(self.sql, params) psycopg2.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. I would expect some user friendly error messages instead of tracebacks Version-Release number of selected component (if applicable): spacewalk-utils-2.5.1-10.el6sat.noarch How reproducible: always Steps to Reproduce: 1. taskotop 2. db-control stop / rhn-satellite-restart Actual results: tracebacks Expected results: error messages
fixed in upstream, spacewalk.git: b2af1e83668c57ded3dc55b76bc0371aa49c2f4c
Verified with spacewalk-utils-2.5.1-23 Taskotop now returns these sensible error messages: * When database is stopped while taskotop is running: ERROR: Some problems occurred during getting information about tasks: Cannot execute SQL statement: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. * When database is stopped before taskotop is started: ERROR: Can't connect to the database: (None, None, 'rhnschema', 'All attempts to connect to the database failed') Check if your database is running.