Skip to content
Snippets Groups Projects
Commit 93fd9bb1 authored by Iustin Pop's avatar Iustin Pop
Browse files

Adjust cfgupgrade for new minor version


Also does some abstracting of the versions.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent f0fa05ac
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
# Copyright (C) 2010, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -285,6 +285,9 @@ class TestCfgupgrade(unittest.TestCase):
def testUpgradeFrom_2_5(self):
self._TestSimpleUpgrade(constants.BuildVersion(2, 5, 0), False)
def testUpgradeFrom_2_6(self):
self._TestSimpleUpgrade(constants.BuildVersion(2, 6, 0), False)
def testUpgradeCurrent(self):
self._TestSimpleUpgrade(constants.CONFIG_VERSION, False)
......@@ -306,6 +309,9 @@ class TestCfgupgrade(unittest.TestCase):
def testUpgradeDryRunFrom_2_5(self):
self._TestSimpleUpgrade(constants.BuildVersion(2, 5, 0), True)
def testUpgradeDryRunFrom_2_6(self):
self._TestSimpleUpgrade(constants.BuildVersion(2, 6, 0), True)
def testUpgradeCurrentDryRun(self):
self._TestSimpleUpgrade(constants.CONFIG_VERSION, True)
......
#!/usr/bin/python
#
# Copyright (C) 2007, 2008, 2009, 2010 Google Inc.
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -46,6 +46,12 @@ options = None
args = None
#: Target major version we will upgrade to
TARGET_MAJOR = 2
#: Target minor version we will upgrade to
TARGET_MINOR = 6
class Error(Exception):
"""Generic exception"""
pass
......@@ -175,13 +181,14 @@ def main():
" configuration file")
# Upgrade from 2.0/2.1/2.2/2.3 to 2.4
if config_major == 2 and config_minor in (0, 1, 2, 3, 4):
if config_major == 2 and config_minor in (0, 1, 2, 3, 4, 5):
if config_revision != 0:
logging.warning("Config revision is %s, not 0", config_revision)
config_data["version"] = constants.BuildVersion(2, 5, 0)
config_data["version"] = constants.BuildVersion(TARGET_MAJOR,
TARGET_MINOR, 0)
elif config_major == 2 and config_minor == 5:
elif config_major == TARGET_MAJOR and config_minor == TARGET_MINOR:
logging.info("No changes necessary")
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment