[migration] don't add new elements to config._cubes in remove_cube
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 17 Jun 2014 11:56:38 +0200
changeset 9829 e0e71b45bf8d
parent 9828 ad0d461ae18b
child 9830 465d8151b92d
[migration] don't add new elements to config._cubes in remove_cube We're expanding dependencies based on the current versions of the cubes, which may well not be the same as the ones known by the db (we're in the middle of an upgrade, after all). Listing them in config._cubes prevents us from calling add_cube() later to actually add them. Closes #4002156
migration.py
--- a/migration.py	Wed Jul 02 11:43:45 2014 +0200
+++ b/migration.py	Tue Jun 17 11:56:38 2014 +0200
@@ -413,7 +413,9 @@
             toremove = (cube,)
         origcubes = self.config._cubes
         basecubes = [c for c in origcubes if not c in toremove]
-        self.config._cubes = tuple(self.config.expand_cubes(basecubes))
+        # don't fake-add any new ones, or we won't be able to really-add them later
+        self.config._cubes = tuple(cube for cube in self.config.expand_cubes(basecubes)
+                                   if cube in origcubes)
         removed = [p for p in origcubes if not p in self.config._cubes]
         if not cube in removed and cube in origcubes:
             raise ConfigurationError("can't remove cube %s, "