]> err.no Git - dak/commitdiff
Work with service mode
authorMark Hymers <mhy@debian.org>
Wed, 23 Mar 2011 14:36:28 +0000 (14:36 +0000)
committerMark Hymers <mhy@debian.org>
Wed, 23 Mar 2011 14:36:28 +0000 (14:36 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/update_db.py

index 985051ece2951cdb003b3ef86493bca4cdb1a080..b58996b1e019b727dc010c27922038b17c22dd11 100755 (executable)
@@ -123,9 +123,12 @@ Updates dak's database schema to the lastest version. You should disable crontab
 
         try:
             # Build a connect string
-            connect_str = "dbname=%s"% (cnf["DB::Name"])
-            if cnf["DB::Host"] != '': connect_str += " host=%s" % (cnf["DB::Host"])
-            if cnf["DB::Port"] != '-1': connect_str += " port=%d" % (int(cnf["DB::Port"]))
+            if cnf["DB::Service"]:
+                connect_str = "service=%s" % cnf["DB::Service"]
+            else:
+                connect_str = "dbname=%s"% (cnf["DB::Name"])
+                if cnf["DB::Host"] != '': connect_str += " host=%s" % (cnf["DB::Host"])
+                if cnf["DB::Port"] != '-1': connect_str += " port=%d" % (int(cnf["DB::Port"]))
 
             self.db = psycopg2.connect(connect_str)