summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py42
-rw-r--r--utils/src/ooinstall/oo_config.py1
-rw-r--r--utils/src/ooinstall/openshift_ansible.py12
3 files changed, 41 insertions, 14 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index 3046d4d58..9839bf447 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -526,10 +526,14 @@ Add new nodes here
def get_installed_hosts(hosts, callback_facts):
installed_hosts = []
for host in hosts:
- if(host.connect_to in callback_facts.keys()
- and 'common' in callback_facts[host.connect_to].keys()
- and callback_facts[host.connect_to]['common'].get('version', '')
- and callback_facts[host.connect_to]['common'].get('version', '') != 'None'):
+ if host.connect_to in callback_facts.keys() and (
+ ('common' in callback_facts[host.connect_to].keys() and
+ callback_facts[host.connect_to]['common'].get('version', '') and
+ callback_facts[host.connect_to]['common'].get('version', '') != 'None') \
+ or
+ ('master' in callback_facts[host.connect_to].keys() and
+ callback_facts[host.connect_to]['master'].get('cluster_method', '') == 'native')
+ ):
installed_hosts.append(host)
return installed_hosts
@@ -722,14 +726,30 @@ def upgrade(ctx):
click.echo("No hosts defined in: %s" % oo_cfg.config_path)
sys.exit(1)
- # Update config to reflect the version we're targetting, we'll write
- # to disk once ansible completes successfully, not before.
old_variant = oo_cfg.settings['variant']
old_version = oo_cfg.settings['variant_version']
- if oo_cfg.settings['variant'] == 'enterprise':
- oo_cfg.settings['variant'] = 'openshift-enterprise'
- version = find_variant(oo_cfg.settings['variant'])[1]
- oo_cfg.settings['variant_version'] = version.name
+
+
+ message = """
+ 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":
+ # TODO: Make this a lot more flexible
+ new_version = "3.1"
+ # 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':
+ oo_cfg.settings['variant'] = 'openshift-enterprise'
+ version = find_variant(oo_cfg.settings['variant'])[1]
+ oo_cfg.settings['variant_version'] = version.name
+ else:
+ 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'],
oo_cfg.settings['variant_version']))
@@ -743,7 +763,7 @@ def upgrade(ctx):
click.echo("Upgrade cancelled.")
sys.exit(0)
- retcode = openshift_ansible.run_upgrade_playbook(verbose)
+ retcode = openshift_ansible.run_upgrade_playbook(old_version, new_version, verbose)
if retcode > 0:
click.echo("Errors encountered during upgrade, please check %s." %
oo_cfg.settings['ansible_log_path'])
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index 33ab27567..4861b1b1b 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -10,6 +10,7 @@ PERSIST_SETTINGS = [
'ansible_ssh_user',
'ansible_config',
'ansible_log_path',
+ 'master_routingconfig_subdomain',
'variant',
'variant_version',
'version',
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index 042ce1023..ec49c9601 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -237,11 +237,17 @@ def run_uninstall_playbook(verbose=False):
return run_ansible(playbook, inventory_file, facts_env, verbose)
-def run_upgrade_playbook(verbose=False):
+def run_upgrade_playbook(old_version, new_version, verbose=False):
# TODO: do not hardcode the upgrade playbook, add ability to select the
# right playbook depending on the type of upgrade.
- playbook = os.path.join(CFG.settings['ansible_playbook_directory'],
- 'playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml')
+ old_version = old_version.replace('.', '_')
+ new_version = old_version.replace('.', '_')
+ if old_version == new_version:
+ playbook = os.path.join(CFG.settings['ansible_playbook_directory'],
+ 'playbooks/byo/openshift-cluster/upgrades/v{}_minor/upgrade.yml'.format(new_version))
+ else:
+ playbook = os.path.join(CFG.settings['ansible_playbook_directory'],
+ 'playbooks/byo/openshift-cluster/upgrades/v{}_to_v{}/upgrade.yml'.format(old_version, new_version))
# TODO: Upgrade inventory for upgrade?
inventory_file = generate_inventory(CFG.hosts)
facts_env = os.environ.copy()