One of the unit tests checks whether cfgupgrade's downgrade option is
idempotent. It is, but a version number check made it impossible to
actually downgrade multiple times.
With this change, both the current-version version number and the
target-version version number are accepted by the downgrade tool.
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
# Downgrade to the previous stable version
if options.downgrade:
- if config_major != TARGET_MAJOR or config_minor != TARGET_MINOR:
+ if not ((config_major == TARGET_MAJOR and config_minor == TARGET_MINOR) or
+ (config_major == DOWNGRADE_MAJOR and
+ config_minor == DOWNGRADE_MINOR)):
raise Error("Downgrade supported only from the latest version (%s.%s),"
" found %s (%s.%s.%s) instead" %
(TARGET_MAJOR, TARGET_MINOR, config_version, config_major,