diff options
author | Scott Dodson <sdodson@redhat.com> | 2016-08-03 08:25:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-03 08:25:19 -0400 |
commit | 45cb9f043ba0405217cb868989f9838a88cdce39 (patch) | |
tree | aff871d071671449b3e9ebc3a756b38a51a9d410 | |
parent | 4d70c314f0f42d6443145b87329dd4a81b59f80e (diff) | |
parent | 21d30a9369fedeee5caac9d3b3360324c7aea676 (diff) | |
download | openshift-45cb9f043ba0405217cb868989f9838a88cdce39.tar.gz openshift-45cb9f043ba0405217cb868989f9838a88cdce39.tar.bz2 openshift-45cb9f043ba0405217cb868989f9838a88cdce39.tar.xz openshift-45cb9f043ba0405217cb868989f9838a88cdce39.zip |
Merge pull request #2243 from smunilla/BZ1359427
a-o-i: Fix broken uninstall
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 10 | ||||
-rw-r--r-- | utils/src/ooinstall/openshift_ansible.py | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index b9750fad1..51c4c2def 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -828,21 +828,25 @@ def uninstall(ctx): oo_cfg = ctx.obj['oo_cfg'] verbose = ctx.obj['verbose'] - if len(oo_cfg.deployment.hosts) == 0: + if hasattr(oo_cfg, 'deployment'): + hosts = oo_cfg.deployment.hosts + elif hasattr(oo_cfg, 'hosts'): + hosts = oo_cfg.hosts + else: click.echo("No hosts defined in: %s" % oo_cfg.config_path) sys.exit(1) click.echo("OpenShift will be uninstalled from the following hosts:\n") if not ctx.obj['unattended']: # Prompt interactively to confirm: - for host in oo_cfg.deployment.hosts: + for host in hosts: click.echo(" * %s" % host.connect_to) proceed = click.confirm("\nDo you wish to proceed?") if not proceed: click.echo("Uninstall cancelled.") sys.exit(0) - openshift_ansible.run_uninstall_playbook(verbose) + openshift_ansible.run_uninstall_playbook(hosts, verbose) @click.command() diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 54178f0cd..f1e03f8f2 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -279,10 +279,10 @@ def run_ansible(playbook, inventory, env_vars, verbose=False): return subprocess.call(args, env=env_vars) -def run_uninstall_playbook(verbose=False): +def run_uninstall_playbook(hosts, verbose=False): playbook = os.path.join(CFG.settings['ansible_playbook_directory'], 'playbooks/adhoc/uninstall.yml') - inventory_file = generate_inventory(CFG.hosts) + inventory_file = generate_inventory(hosts) facts_env = os.environ.copy() if 'ansible_log_path' in CFG.settings: facts_env['ANSIBLE_LOG_PATH'] = CFG.settings['ansible_log_path'] |