[FIX] When using "--stop-after-init", set the return code correctly. A non zero return code reflect the number of databases that fail to load/update
bzr revid: chs@openerp.com-20130506103054-kb91drgkbj3z5799
This commit is contained in:
parent
71530a3a9b
commit
2c4e370b76
|
@ -98,6 +98,8 @@ def preload_registry(dbname):
|
|||
openerp.modules.registry.RegistryManager.new(dbname, update_module=update_module)
|
||||
except Exception:
|
||||
_logger.exception('Failed to initialize database `%s`.', dbname)
|
||||
return False
|
||||
return True
|
||||
|
||||
def run_test_file(dbname, test_file):
|
||||
""" Preload a registry, possibly run a test file, and start the cron."""
|
||||
|
@ -261,12 +263,14 @@ def main(args):
|
|||
else:
|
||||
openerp.service.start_services()
|
||||
|
||||
rc = 0
|
||||
if config['db_name']:
|
||||
for dbname in config['db_name'].split(','):
|
||||
preload_registry(dbname)
|
||||
if not preload_registry(dbname):
|
||||
rc += 1
|
||||
|
||||
if config["stop_after_init"]:
|
||||
sys.exit(0)
|
||||
sys.exit(rc)
|
||||
|
||||
_logger.info('OpenERP server is running, waiting for connections...')
|
||||
quit_on_signals()
|
||||
|
|
Loading…
Reference in New Issue