[migration] set a cnxset before process_script()
Not pretty, but I don't have a better idea right now and this at least
ensures migration scripts get run in the expected environment and can
access sql stuff as before.
--- 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__