[cwctl] Only start the instance after upgrade if it was running before stable
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 10 Oct 2013 16:56:16 +0200
branchstable
changeset 9315 5298cfb132e6
parent 9314 178791fde195
child 9316 38518284c200
[cwctl] Only start the instance after upgrade if it was running before Closes #3207676.
cwctl.py
--- a/cwctl.py	Thu Oct 24 09:20:45 2013 +0200
+++ b/cwctl.py	Thu Oct 10 16:56:16 2013 +0200
@@ -751,6 +751,7 @@
         print '\n' + underline_title('Upgrading the instance %s' % appid)
         from logilab.common.changelog import Version
         config = cwcfg.config_for(appid)
+        instance_running = exists(config['pid-file'])
         config.repairing = True # notice we're not starting the server
         config.verbosity = self.config.verbosity
         set_sources_mode = getattr(config, 'set_sources_mode', None)
@@ -782,7 +783,7 @@
         if cubicwebversion > applcubicwebversion:
             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
         # only stop once we're sure we have something to do
-        if not (CWDEV or self.config.nostartstop):
+        if instance_running and not (CWDEV or self.config.nostartstop):
             StopInstanceCommand(self.logger).stop_instance(appid)
         # run cubicweb/componants migration scripts
         if self.config.fs_only or toupgrade:
@@ -799,7 +800,7 @@
             return
         print
         print '-> instance migrated.'
-        if not (CWDEV or self.config.nostartstop):
+        if instance_running and not (CWDEV or self.config.nostartstop):
             # restart instance through fork to get a proper environment, avoid
             # uicfg pb (and probably gettext catalogs, to check...)
             forkcmd = '%s start %s' % (sys.argv[0], appid)