Jelajahi Sumber

a-o-i: More flexible upgrade mappings

Change the upgrade logic to allow for more than two types of upgrades.
Samuel Munilla 9 tahun lalu
induk
melakukan
9748415c1b
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      utils/src/ooinstall/cli_installer.py

+ 4 - 2
utils/src/ooinstall/cli_installer.py

@@ -762,6 +762,9 @@ def uninstall(ctx):
     oo_cfg = ctx.obj['oo_cfg']
     verbose = ctx.obj['verbose']
 
+    upgrade_mappings = {'3.0':'3.1',
+                        '3.1':'3.2'}
+
     if len(oo_cfg.hosts) == 0:
         click.echo("No hosts defined in: %s" % oo_cfg.config_path)
         sys.exit(1)
@@ -802,8 +805,7 @@ def upgrade(ctx):
     resp = click.prompt("(1) Update to latest {} (2) Migrate to next relese".format(old_version))
 
     if resp == "2":
-        # TODO: Make this a lot more flexible
-        new_version = "3.1"
+        new_version = upgrade_mappings.get(old_version)
         # Update config to reflect the version we're targetting, we'll write
         # to disk once ansible completes successfully, not before.
         if oo_cfg.settings['variant'] == 'enterprise':