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>
  run(sys.argv[1:])
File "/usr/lib/python2.5/site-packages/cubicweb/cwctl.py", line 961, in run
  CWCTL.run(args)
File "/var/lib/python-support/python2.5/logilab/common/clcommands.py", line 128, in run
  sys.exit(command.main_run(args, rcfile))
File "/var/lib/python-support/python2.5/logilab/common/clcommands.py", line 254, in main_run
  self.run(args)
File "/usr/lib/python2.5/site-packages/cubicweb/server/serverctl.py", 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/serverctl.py", 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/serverctl.py", 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/serverctl.py", line 88, in source_cnx
  **extra)
File "/var/lib/python-support/python2.5/logilab/database/__init__.py", line 97, in get_connection
  port=port, extra_args=extra_args)
File "/var/lib/python-support/python2.5/logilab/database/postgres.py", 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
prioritynormal
typebug
done in<not specified>
load0.300
load left0.300
closed by<not specified>