Don't start the server if init or update without database option
This commit is contained in:
1 parent
53cc250bca
commit
bab0ad457e
2 files changed
+7
-2
No files matched your search
+2
-2
@@ -102,14 +102,14 @@ class ConfigManager(object):
|
||||
self.options['db_name'] = db_name
|
||||
|
||||
init = {}
|
||||
if opt.init and self.options.get('db_name'):
|
||||
if opt.init:
|
||||
for i in opt.init.split(','):
|
||||
if i != 'tests':
|
||||
init[i] = 1
|
||||
self.options['init'] = init
|
||||
|
||||
update = {}
|
||||
if opt.update and self.options.get('db_name'):
|
||||
if opt.update:
|
||||
for i in opt.update.split(','):
|
||||
if i != 'tests':
|
||||
update[i] = 1
|
||||
|
||||
@@ -70,6 +70,11 @@ class TrytonServer(object):
|
||||
|
||||
update = False
|
||||
init = {}
|
||||
|
||||
if not CONFIG["db_name"] \
|
||||
and bool(CONFIG['init'] or CONFIG['update']):
|
||||
raise Exception('Missing database option!')
|
||||
|
||||
for db_name in CONFIG["db_name"]:
|
||||
init[db_name] = False
|
||||
database = Database(db_name).connect()
|
||||
|
||||
Reference in new issue
Block a user