improve config version check
This commit is contained in:
parent
b8808ac8b0
commit
542f5db58e
|
|
@ -140,7 +140,11 @@ class Migrator(object):
|
||||||
def migrate(config):
|
def migrate(config):
|
||||||
version = config["version"] if "version" in config else 1
|
version = config["version"] if "version" in config else 1
|
||||||
if version == Migrator.currentVersion:
|
if version == Migrator.currentVersion:
|
||||||
return config
|
return
|
||||||
|
elif version > Migrator.currentVersion:
|
||||||
|
raise ValueError(
|
||||||
|
"Configuration version is too high (current: {}, found: {})".format(Migrator.currentVersion, version)
|
||||||
|
)
|
||||||
|
|
||||||
logger.debug("migrating config from version %i", version)
|
logger.debug("migrating config from version %i", version)
|
||||||
migrators = [Migrator.migrators[i] for i in range(version, Migrator.currentVersion)]
|
migrators = [Migrator.migrators[i] for i in range(version, Migrator.currentVersion)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue