summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2015-10-28 12:12:39 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2015-10-28 15:11:10 -0300
commit7197aba51d24ab2cf6cde77efa853903d7ddd5ba (patch)
treeaa17b2d3cf041791b1b9633cad5ab3517d8de8d6
parent93b2a9bd2f4a3b93be3cb51ecf034000a652496e (diff)
downloadopenshift-7197aba51d24ab2cf6cde77efa853903d7ddd5ba.tar.gz
openshift-7197aba51d24ab2cf6cde77efa853903d7ddd5ba.tar.bz2
openshift-7197aba51d24ab2cf6cde77efa853903d7ddd5ba.tar.xz
openshift-7197aba51d24ab2cf6cde77efa853903d7ddd5ba.zip
Block upgrade if targetting enterprise deployment type.
enterprise is being phased out in favor of openshift-enterprise, you need to specify where you wish to go.
-rw-r--r--playbooks/adhoc/upgrades/upgrade.yml8
-rw-r--r--utils/src/ooinstall/cli_installer.py21
-rw-r--r--utils/src/ooinstall/install_transactions.py12
3 files changed, 41 insertions, 0 deletions
diff --git a/playbooks/adhoc/upgrades/upgrade.yml b/playbooks/adhoc/upgrades/upgrade.yml
index 56a1df860..e8d6a335d 100644
--- a/playbooks/adhoc/upgrades/upgrade.yml
+++ b/playbooks/adhoc/upgrades/upgrade.yml
@@ -1,4 +1,12 @@
---
+- name: Verify deployment type
+ hosts: masters
+ tasks:
+ # Checking the global deployment type rather than host facts, this is about
+ # what the user is requesting.
+ - fail: msg="Deployment type enterprise not supported for upgrade"
+ when: deployment_type == "enterprise"
+
- name: Re-Run cluster configuration to apply latest configuration changes
include: ../../common/openshift-cluster/config.yml
vars:
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index 03f86a166..e22217fdb 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -459,6 +459,26 @@ def uninstall(ctx):
install_transactions.run_uninstall_playbook()
+@click.command()
+@click.pass_context
+def upgrade(ctx):
+ oo_cfg = ctx.obj['oo_cfg']
+
+ if len(oo_cfg.hosts) == 0:
+ click.echo("No hosts defined in: %s" % oo_cfg['configuration'])
+ sys.exit(1)
+
+ click.echo("OpenShift will be upgraded on the following hosts:\n")
+ if not ctx.obj['unattended']:
+ # Prompt interactively to confirm:
+ for host in oo_cfg.hosts:
+ click.echo(" * %s" % host.name)
+ proceed = click.confirm("\nDo you wish to proceed?")
+ if not proceed:
+ click.echo("Upgrade cancelled.")
+ sys.exit(0)
+ install_transactions.run_upgrade_playbook()
+
@click.command()
@click.option('--force', '-f', is_flag=True, default=False)
@@ -523,6 +543,7 @@ http://docs.openshift.com/enterprise/latest/admin_guide/overview.html
click.pause()
cli.add_command(install)
+cli.add_command(upgrade)
cli.add_command(uninstall)
if __name__ == '__main__':
diff --git a/utils/src/ooinstall/install_transactions.py b/utils/src/ooinstall/install_transactions.py
index 3306271c8..60b0f3d9f 100644
--- a/utils/src/ooinstall/install_transactions.py
+++ b/utils/src/ooinstall/install_transactions.py
@@ -143,3 +143,15 @@ def run_uninstall_playbook():
if 'ansible_config' in CFG.settings:
facts_env['ANSIBLE_CONFIG'] = CFG.settings['ansible_config']
return run_ansible(playbook, inventory_file, facts_env)
+
+def run_upgrade_playbook():
+ playbook = os.path.join(CFG.settings['ansible_playbook_directory'],
+ 'playbooks/adhoc/upgrades/upgrade.yml')
+ # TODO: Upgrade inventory for upgrade?
+ inventory_file = generate_inventory(CFG.hosts)
+ facts_env = os.environ.copy()
+ if 'ansible_log_path' in CFG.settings:
+ facts_env['ANSIBLE_LOG_PATH'] = CFG.settings['ansible_log_path']
+ if 'ansible_config' in CFG.settings:
+ facts_env['ANSIBLE_CONFIG'] = CFG.settings['ansible_config']
+ return run_ansible(playbook, inventory_file, facts_env)