X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fupdate_db.py;h=2147524956b823de7ff11dc972e63aec69f7971e;hb=13a1194328f9ce5d2e9bdc5405b5e3b2a4ceb845;hp=424359a384c807b95247aa2f01f06828330aa24b;hpb=272a832d3fcc643626e863388921ee29c2110ee5;p=dak.git diff --git a/dak/update_db.py b/dak/update_db.py index 424359a3..21475249 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -46,7 +46,7 @@ from daklib.daklog import Logger ################################################################################ Cnf = None -required_database_schema = 49 +required_database_schema = 64 ################################################################################ @@ -119,11 +119,11 @@ Updates dak's database schema to the lastest version. You should disable crontab # Ok, try and find the configuration table print "Determining dak database revision ..." cnf = Config() - logger = Logger(cnf.Cnf, 'update-db') + logger = Logger('update-db') try: # Build a connect string - if cnf["DB::Service"]: + if cnf.has_key("DB::Service"): connect_str = "service=%s" % cnf["DB::Service"] else: connect_str = "dbname=%s"% (cnf["DB::Name"]) @@ -134,7 +134,7 @@ Updates dak's database schema to the lastest version. You should disable crontab except: print "FATAL: Failed connect to database" - pass + sys.exit(1) database_revision = int(self.get_db_rev()) logger.log(['transaction id before update: %s' % self.get_transaction_id()]) @@ -198,7 +198,7 @@ Updates dak's database schema to the lastest version. You should disable crontab self.usage(exit_code=1) try: - lock_fd = os.open(cnf["Dinstall::LockFile"], os.O_RDWR | os.O_CREAT) + lock_fd = os.open(os.path.join(cnf["Dir::Lock"], 'dinstall.lock'), 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':