summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-07-07 15:05:11 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-07-08 09:51:59 -0300
commit6ec757e4449fbc59f509f980bd9423bdb35412eb (patch)
tree21f69c5a163f911ca192f7ef0d5d04c1297cd71f /utils
parent1a2c22a060b8b6f0e64d452fdfc13012d3c067ed (diff)
downloadopenshift-6ec757e4449fbc59f509f980bd9423bdb35412eb.tar.gz
openshift-6ec757e4449fbc59f509f980bd9423bdb35412eb.tar.bz2
openshift-6ec757e4449fbc59f509f980bd9423bdb35412eb.tar.xz
openshift-6ec757e4449fbc59f509f980bd9423bdb35412eb.zip
Update quick upgrade to remove unsupported options.
Upgrade mappings can now optionally support an upgrade to latest minor version, and an upgrade to next major version. Dropped the "minor_version" as it is already defined by the mapping key. For 3.2 the minor upgrade playbook is the same as the major.
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py67
1 files changed, 44 insertions, 23 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index c896a74b4..cd74ed233 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -828,46 +828,63 @@ def upgrade(ctx, latest_minor, next_major):
oo_cfg = ctx.obj['oo_cfg']
verbose = ctx.obj['verbose']
+ # major/minor fields are optional, as we don't always support minor/major
+ # upgrade for what you're currently running.
upgrade_mappings = {
- '3.0':{
- 'minor_version' :'3.0',
- 'minor_playbook':'v3_0_minor/upgrade.yml',
- 'major_version' :'3.1',
- 'major_playbook':'v3_0_to_v3_1/upgrade.yml',
- },
'3.1':{
- 'minor_version' :'3.1',
- 'minor_playbook':'v3_1_minor/upgrade.yml',
'major_playbook':'v3_1_to_v3_2/upgrade.yml',
'major_version' :'3.2',
- }
+ },
+ '3.2':{
+ 'minor_playbook':'v3_1_to_v3_2/upgrade.yml',
+# Uncomment these when we're ready to support 3.3.
+# 'major_version' :'3.3',
+# 'major_playbook':'v3_1_to_v3_2/upgrade.yml',
+ },
}
if len(oo_cfg.hosts) == 0:
click.echo("No hosts defined in: %s" % oo_cfg.config_path)
sys.exit(1)
- old_variant = oo_cfg.settings['variant']
+ variant = oo_cfg.settings['variant']
+ if find_variant(variant)[0] is None:
+ click.echo("%s is not a supported variant for upgrade." % variant)
+ sys.exit(0)
+
old_version = oo_cfg.settings['variant_version']
mapping = upgrade_mappings.get(old_version)
message = """
This tool will help you upgrade your existing OpenShift installation.
+ Currently running: %s %s
"""
- click.echo(message)
+ click.echo(message % (variant, old_version))
+ # Map the dynamic upgrade options to the playbook to run for each.
+ # Index offset by 1.
+ # List contains tuples of booleans for (latest_minor, next_major)
+ selections = []
if not (latest_minor or next_major):
- click.echo("Version {} found. Do you want to update to the latest version of {} " \
- "or migrate to the next major release?".format(old_version, old_version))
- response = click.prompt("(1) Update to latest {} " \
- "(2) Migrate to next release".format(old_version),
- type=click.Choice(['1', '2']),)
- if response == "1":
- latest_minor = True
- if response == "2":
- next_major = True
+ i = 0
+ if 'minor_playbook' in mapping:
+ click.echo("(%s) Update to latest %s" % (i + 1, old_version))
+ selections.append((True, False))
+ i += 1
+ if 'major_playbook' in mapping:
+ click.echo("(%s) Upgrade to next release: %s" % (i + 1, mapping['major_version']))
+ selections.append((False, True))
+ i += 1
+
+ response = click.prompt("\nChoose an option from above",
+ type=click.Choice(list(map(str, range(1, len(selections) + 1)))))
+ latest_minor, next_major = selections[int(response) - 1]
if next_major:
+ if 'major_playbook' not in mapping:
+ click.echo("No major upgrade supported for %s %s with this version "\
+ "of atomic-openshift-utils." % (variant, version))
+ sys.exit(0)
playbook = mapping['major_playbook']
new_version = mapping['major_version']
# Update config to reflect the version we're targetting, we'll write
@@ -877,11 +894,15 @@ def upgrade(ctx, latest_minor, next_major):
oo_cfg.settings['variant'] = 'openshift-enterprise'
if latest_minor:
+ if 'minor_playbook' not in mapping:
+ click.echo("No minor upgrade supported for %s %s with this version "\
+ "of atomic-openshift-utils." % (variant, old_version))
+ sys.exit(0)
playbook = mapping['minor_playbook']
- new_version = mapping['minor_version']
+ new_version = old_version
- click.echo("Openshift will be upgraded from %s %s to %s %s on the following hosts:\n" % (
- old_variant, old_version, oo_cfg.settings['variant'], new_version))
+ click.echo("Openshift will be upgraded from %s %s to latest %s %s on the following hosts:\n" % (
+ variant, old_version, oo_cfg.settings['variant'], new_version))
for host in oo_cfg.hosts:
click.echo(" * %s" % host.connect_to)