summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2016-03-02 13:15:03 -0500
committerSamuel Munilla <smunilla@redhat.com>2016-03-23 13:06:16 -0400
commitae78eb0bbe01edd97cd25f13adcce0bf38278ff3 (patch)
tree56f78b4931ae3fafc13376a81ce9514af36d28be /utils
parent9748415c1be0c0e15b2fb3c37a0d17e0f4672005 (diff)
downloadopenshift-ae78eb0bbe01edd97cd25f13adcce0bf38278ff3.tar.gz
openshift-ae78eb0bbe01edd97cd25f13adcce0bf38278ff3.tar.bz2
openshift-ae78eb0bbe01edd97cd25f13adcce0bf38278ff3.tar.xz
openshift-ae78eb0bbe01edd97cd25f13adcce0bf38278ff3.zip
a-o-i: Support for unattended upgrades
Adds the ability to perform upgrades without any user input through: atomic-openshift-installer --unattended upgrade --next-major or atomic-openshift-installer --unattended upgrade --latest-minor
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index 4f7af0465..477d6359b 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -783,8 +783,10 @@ def uninstall(ctx):
@click.command()
+@click.option('--latest-minor', '-l', is_flag=True, default=False)
+@click.option('--next-major', '-n', is_flag=True, default=False)
@click.pass_context
-def upgrade(ctx):
+def upgrade(ctx, latest_minor, next_major):
oo_cfg = ctx.obj['oo_cfg']
verbose = ctx.obj['verbose']
@@ -800,11 +802,19 @@ def upgrade(ctx):
This tool will help you upgrade your existing OpenShift installation.
"""
click.echo(message)
- 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))
- resp = click.prompt("(1) Update to latest {} (2) Migrate to next relese".format(old_version))
- if resp == "2":
+ 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
+
+ if next_major:
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.
@@ -812,7 +822,8 @@ def upgrade(ctx):
oo_cfg.settings['variant'] = 'openshift-enterprise'
version = find_variant(oo_cfg.settings['variant'])[1]
oo_cfg.settings['variant_version'] = version.name
- else:
+
+ if latest_minor:
new_version = old_version
click.echo("Openshift will be upgraded from %s %s to %s %s on the following hosts:\n" % (