[FIX] When using "--stop-after-init", set the return code correctly. A non zero retur...
authorChristophe Simonis <chs@openerp.com>
Mon, 6 May 2013 10:30:54 +0000 (12:30 +0200)
committerChristophe Simonis <chs@openerp.com>
Mon, 6 May 2013 10:30:54 +0000 (12:30 +0200)
bzr revid: chs@openerp.com-20130506103054-kb91drgkbj3z5799

openerp/cli/server.py

index 638fb08..0315468 100644 (file)
@@ -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()