server/migractions.py
changeset 9686 9a04e48e780b
parent 9636 e35ae8617c03
child 9750 566f8fce5168
--- a/server/migractions.py	Thu Apr 10 11:04:13 2014 +0200
+++ b/server/migractions.py	Fri Apr 18 14:25:36 2014 +0200
@@ -179,14 +179,15 @@
             super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options)
 
     def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs):
-        try:
-            return super(ServerMigrationHelper, self).cmd_process_script(
-                  migrscript, funcname, *args, **kwargs)
-        except ExecutionError as err:
-            sys.stderr.write("-> %s\n" % err)
-        except BaseException:
-            self.rollback()
-            raise
+        with self.cnx._cnx.ensure_cnx_set:
+            try:
+                return super(ServerMigrationHelper, self).cmd_process_script(
+                      migrscript, funcname, *args, **kwargs)
+            except ExecutionError as err:
+                sys.stderr.write("-> %s\n" % err)
+            except BaseException:
+                self.rollback()
+                raise
 
     # Adjust docstring
     cmd_process_script.__doc__ = MigrationHelper.cmd_process_script.__doc__