summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall
diff options
context:
space:
mode:
authorGan Huang <ghuang@redhat.com>2016-08-13 01:31:49 +0800
committerAndrew Butcher <abutcher@redhat.com>2016-08-15 11:43:50 -0400
commit7c89c935a83cef41a001b07d66bf8edee1aa45eb (patch)
treec030f4d92f94391f32bc21548660f98011867868 /utils/src/ooinstall
parent41cd5f40fe33ba286367c98b50959dd9f3a3ac89 (diff)
downloadopenshift-7c89c935a83cef41a001b07d66bf8edee1aa45eb.tar.gz
openshift-7c89c935a83cef41a001b07d66bf8edee1aa45eb.tar.bz2
openshift-7c89c935a83cef41a001b07d66bf8edee1aa45eb.tar.xz
openshift-7c89c935a83cef41a001b07d66bf8edee1aa45eb.zip
a-o-i: fix bz#1329455
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r--utils/src/ooinstall/cli_installer.py40
1 files changed, 18 insertions, 22 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index e197c722d..50f04872a 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -1,3 +1,5 @@
+# TODO: Temporarily disabled due to importing old code into openshift-ansible
+# repo. We will work on these over time.
# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name,no-value-for-parameter,too-many-lines
import os
@@ -657,22 +659,14 @@ Add new nodes here
def get_installed_hosts(hosts, callback_facts):
installed_hosts = []
-
- # count nativeha lb as an installed host
- try:
- first_master = next(host for host in hosts if host.is_master())
- lb_hostname = callback_facts[first_master.connect_to]['master'].get('cluster_hostname', '')
- lb_host = \
- next(host for host in hosts if host.ip == callback_facts[lb_hostname]['common']['ip'])
-
- installed_hosts.append(lb_host)
- except (KeyError, StopIteration):
- pass
-
+ uninstalled_hosts = []
for host in [h for h in hosts if h.is_master() or h.is_node()]:
- if host.connect_to in callback_facts.keys() and is_installed_host(host, callback_facts):
- installed_hosts.append(host)
- return installed_hosts
+ if host.connect_to in callback_facts.keys():
+ if is_installed_host(host, callback_facts):
+ installed_hosts.append(host)
+ else:
+ uninstalled_hosts.append(host)
+ return installed_hosts, uninstalled_hosts
def is_installed_host(host, callback_facts):
version_found = 'common' in callback_facts[host.connect_to].keys() and \
@@ -689,7 +683,7 @@ def get_hosts_to_run_on(oo_cfg, callback_facts, unattended, force, verbose):
hosts_to_run_on = list(oo_cfg.deployment.hosts)
# Check if master or nodes already have something installed
- installed_hosts = get_installed_hosts(oo_cfg.deployment.hosts, callback_facts)
+ installed_hosts, uninstalled_hosts = get_installed_hosts(oo_cfg.deployment.hosts, callback_facts)
if len(installed_hosts) > 0:
click.echo('Installed environment detected.')
# This check has to happen before we start removing hosts later in this method
@@ -723,13 +717,15 @@ def get_hosts_to_run_on(oo_cfg, callback_facts, unattended, force, verbose):
hosts_to_run_on.remove(host)
# Handle the cases where we know about uninstalled systems
- new_hosts = set(hosts_to_run_on) - set(installed_hosts)
- if len(new_hosts) > 0:
- for new_host in new_hosts:
- click.echo("{} is currently uninstalled".format(new_host))
-
+ if len(uninstalled_hosts) > 0:
+ for uninstalled_host in uninstalled_hosts:
+ click.echo("{} is currently uninstalled".format(uninstalled_host))
# Fall through
- click.echo('Adding additional nodes...')
+ click.echo('\nUninstalled hosts have been detected in your environment. ' \
+ 'Please make sure your environment was installed successfully ' \
+ 'before adding new nodes. If you want a fresh install, use ' \
+ '`atomic-openshift-installer install --force`')
+ sys.exit(1)
else:
if unattended:
if not force: