cubicweb #1368915 Catch identification error traceback when creating database [open]

When you get something wrong with the identification to connect to the database, you end up with a nasty traceback

Creating the system database
Traceback (most recent call last):
File "/usr/bin/cubicweb-ctl", line 4, in <module>
File "/usr/lib/python2.5/site-packages/cubicweb/", line 961, in run
File "/var/lib/python-support/python2.5/logilab/common/", line 128, in run
  sys.exit(command.main_run(args, rcfile))
File "/var/lib/python-support/python2.5/logilab/common/", line 254, in main_run
File "/usr/lib/python2.5/site-packages/cubicweb/server/", line 315, in run
  dbcnx = _db_sys_cnx(source, 'CREATE DATABASE and / or USER', verbose=verbose)
File "/usr/lib/python2.5/site-packages/cubicweb/server/", line 126, in   _db_sys_cnx
  cnx = system_source_cnx(source, True, special_privs=special_privs, verbose=verbose)
File "/usr/lib/python2.5/site-packages/cubicweb/server/", line 108, in system_source_cnx
  return source_cnx(source, system_db, special_privs=special_privs, verbose=verbose)
File "/usr/lib/python2.5/site-packages/cubicweb/server/", line 88, in source_cnx
File "/var/lib/python-support/python2.5/logilab/database/", line 97, in get_connection
  port=port, extra_args=extra_args)
File "/var/lib/python-support/python2.5/logilab/database/", line 83, in connect
  cnx = self._native_module.connect(cnx_string)
psycopg2.OperationalError: FATAL:  Ident authentication failed for user "cubicweb"

It would be nice to catch this traceback and give the user a user friendly error and a choice between :

  • change ident info
  • try again (has another terminal where the user added the user)
  • quit
done in<not specified>
load left0.300
closed by<not specified>