cwctl.py
changeset 5811 e77cea9721e7
parent 5627 a7e40cccdc9b
parent 5796 351e84e18a61
child 5814 51cc4b61f9ae
--- a/cwctl.py	Fri Jun 18 18:31:22 2010 +0200
+++ b/cwctl.py	Mon Jun 21 13:23:11 2010 +0200
@@ -730,7 +730,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)
@@ -741,6 +743,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
@@ -752,21 +770,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