closes #1059729: cw-ctl upgrade : i18n upgrade not performed if DB does not need upgrade stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 18 Jun 2010 18:49:17 +0200
branchstable
changeset 5796 351e84e18a61
parent 5793 1faff41593df
child 5798 74d9a062965c
closes #1059729: cw-ctl upgrade : i18n upgrade not performed if DB does not need upgrade
cwctl.py
--- a/cwctl.py	Fri Jun 18 18:14:55 2010 +0200
+++ b/cwctl.py	Fri Jun 18 18:49:17 2010 +0200
@@ -731,7 +731,9 @@
         if cubicwebversion > applcubicwebversion:
             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
         if not self.config.fs_only and not toupgrade:
-            print '-> no software migration needed for instance %s.' % appid
+            print '-> no data migration needed for instance %s.' % appid
+            self.i18nupgrade(config)
+            mih.shutdown()
             return
         for cube, fromversion, toversion in toupgrade:
             print '-> migration needed from %s to %s for %s' % (fromversion, toversion, cube)
@@ -742,6 +744,22 @@
         mih.migrate(vcconf, reversed(toupgrade), self.config)
         # rewrite main configuration file
         mih.rewrite_configuration()
+        mih.shutdown()
+        # handle i18n upgrade
+        if not self.i18nupgrade(config):
+            return
+        print
+        print '-> instance migrated.'
+        if 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)
+            status = system(forkcmd)
+            if status:
+                print '%s exited with status %s' % (forkcmd, status)
+        print
+
+    def i18nupgrade(self, config):
         # handle i18n upgrade:
         # * install new languages
         # * recompile catalogs
@@ -753,21 +771,10 @@
         if errors:
             print '\n'.join(errors)
             if not ASK.confirm('Error while compiling message catalogs, '
-                               'continue anyway ?'):
+                               'continue anyway?'):
                 print '-> migration not completed.'
-                return
-        mih.shutdown()
-        print
-        print '-> instance migrated.'
-        if 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)
-            status = system(forkcmd)
-            if status:
-                print '%s exited with status %s' % (forkcmd, status)
-        print
-
+                return False
+        return True
 
 class ShellCommand(Command):
     """Run an interactive migration shell on an instance. This is a python shell