From ca92aad2e0267a71fc089db42bb3eb802065fb13 Mon Sep 17 00:00:00 2001 From: Mark Hymers Date: Wed, 23 Mar 2011 14:36:28 +0000 Subject: [PATCH] Work with service mode Signed-off-by: Mark Hymers --- dak/update_db.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dak/update_db.py b/dak/update_db.py index 985051ec..b58996b1 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -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) -- 2.39.5