stop application only once we're sure we've something to do, fixing #342689
authorsylvain.thenault@logilab.fr
Fri, 17 Apr 2009 18:58:03 +0200
changeset 1404 971b19de6b85
parent 1395 e7f12251945a
child 1405 4233089f7fb2
stop application only once we're sure we've something to do, fixing #342689
cwctl.py
--- a/cwctl.py	Fri Apr 17 10:00:26 2009 +0200
+++ b/cwctl.py	Fri Apr 17 18:58:03 2009 +0200
@@ -614,8 +614,6 @@
     
     def upgrade_application(self, appid):
         from logilab.common.changelog import Version
-        if not (CubicWebConfiguration.mode == 'dev' or self.config.nostartstop):
-            self.stop_application(appid)
         config = CubicWebConfiguration.config_for(appid)
         config.creating = True # notice we're not starting the server
         config.verbosity = self.config.verbosity
@@ -659,6 +657,9 @@
             return
         for cube, fromversion, toversion in toupgrade:
             print '**** %s migration %s -> %s' % (cube, fromversion, toversion)
+        # only stop once we're sure we have something to do
+        if not (CubicWebConfiguration.mode == 'dev' or self.config.nostartstop):
+            self.stop_application(appid)
         # run cubicweb/componants migration scripts
         mih.migrate(vcconf, reversed(toupgrade), self.config)
         # rewrite main configuration file