]> git.decadent.org.uk Git - dak.git/blobdiff - dak/update_db.py
merge from master
[dak.git] / dak / update_db.py
index 7d7fe9fe596a91082d816d77f8490e1661967c96..88d8e4e66e6425e91a6501c5c09af21a8e395b5a 100755 (executable)
@@ -107,10 +107,9 @@ 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"])
-            connect_str = "dbname=%s"% "projectbstew"
-#            if Cnf["DB::Host"] != '': connect_str += " host=%s" % (Cnf["DB::Host"])
-#            if Cnf["DB::Port"] != '-1': connect_str += " port=%d" % (int(Cnf["DB::Port"]))
+            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)
 
@@ -177,12 +176,12 @@ Updates dak's database schema to the lastest version. You should disable crontab
 
         self.update_db()
 
-#STU        try:
-#STU            lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT)
-#STU            fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
-#STU        except IOError, e:
-#STU            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
-#STU                utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.")
+        try:
+            lock_fd = os.open(Cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT)
+            fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
+        except IOError, e:
+            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
+                utils.fubar("Couldn't obtain lock; assuming another 'dak process-unchecked' is already running.")
 
 
 ################################################################################