[cwctl] reset-admin-pwd was failing when db-host was not set stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sat, 09 Jan 2010 15:31:37 +0100
branchstable
changeset 4218 deb2dcffb301
parent 4217 bf2811a17a17
child 4219 87203a0a3a81
[cwctl] reset-admin-pwd was failing when db-host was not set
server/serverctl.py
--- a/server/serverctl.py	Fri Jan 08 18:20:03 2010 +0100
+++ b/server/serverctl.py	Sat Jan 09 15:31:37 2010 +0100
@@ -30,11 +30,15 @@
     """
     from getpass import getpass
     from logilab.common.db import get_connection
-    dbhost = source['db-host']
+    dbhost = source.get('db-host')
     if dbname is None:
         dbname = source['db-name']
     driver = source['db-driver']
-    print '-> connecting to %s database %s@%s' % (driver, dbname, dbhost or 'localhost'),
+    print '-> connecting to %s database' % driver,
+    if dbhost:
+        print '%s@%s' % (dbname, dbhost),
+    else:
+        print dbname,
     if not verbose or (not special_privs and source.get('db-user')):
         user = source['db-user']
         print 'as', user