summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSamuel Munilla <smunilla@redhat.com>2015-11-20 15:34:35 -0500
committerSamuel Munilla <smunilla@redhat.com>2015-11-23 18:05:26 -0500
commit16e373e9c71f929e3eaf5d747e1f1ad9057c0184 (patch)
tree476c7da7f9e5c9f45d1e1f9d657de2f2e88c2e5c /utils
parent992d147e722795be98bcb1a8b890c66035ab6c49 (diff)
downloadopenshift-16e373e9c71f929e3eaf5d747e1f1ad9057c0184.tar.gz
openshift-16e373e9c71f929e3eaf5d747e1f1ad9057c0184.tar.bz2
openshift-16e373e9c71f929e3eaf5d747e1f1ad9057c0184.tar.xz
openshift-16e373e9c71f929e3eaf5d747e1f1ad9057c0184.zip
atomic-openshift-installer: Reverse version and host collection
Reverse the order we ask two questions: What variant the user wants to install and which hosts to install on. This lets us avoid asking for multiple masters for 3.0 installs.
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py18
-rw-r--r--utils/test/cli_installer_tests.py6
2 files changed, 13 insertions, 11 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index fce8f9b22..01093379f 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -72,7 +72,7 @@ def delete_hosts(hosts):
click.echo("\"{}\" doesn't coorespond to any valid input.".format(del_idx))
return hosts, None
-def collect_hosts(masters_set=False):
+def collect_hosts(version=None, masters_set=False):
"""
Collect host information from user. This will later be filled in using
ansible.
@@ -117,7 +117,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen
if num_masters > 1:
hosts.append(collect_ha_proxy())
- if num_masters >= 3:
+ if num_masters >= 3 or version == '3.0':
masters_set = True
host_props['node'] = True
@@ -265,7 +265,7 @@ Would you like to label the colocated masters as scheduleable?
return
-def get_variant_and_version():
+def get_variant_and_version(multi_master=False):
message = "\nWhich variant would you like to install?\n\n"
i = 1
@@ -277,6 +277,8 @@ def get_variant_and_version():
message = "%s\n" % message
click.echo(message)
+ if multi_master:
+ click.echo('NOTE: 3.0 installations are not')
response = click.prompt("Choose a variant from above: ", default=1)
product, version = combos[response - 1]
@@ -358,16 +360,16 @@ https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.h
oo_cfg.settings['ansible_ssh_user'] = get_ansible_ssh_user()
click.clear()
- if not oo_cfg.hosts:
- oo_cfg.hosts = collect_hosts()
- click.clear()
-
if oo_cfg.settings.get('variant', '') == '':
variant, version = get_variant_and_version()
oo_cfg.settings['variant'] = variant.name
oo_cfg.settings['variant_version'] = version.name
click.clear()
+ if not oo_cfg.hosts:
+ oo_cfg.hosts = collect_hosts(version=oo_cfg.settings['variant_version'])
+ click.clear()
+
return oo_cfg
@@ -378,7 +380,7 @@ def collect_new_nodes():
Add new nodes here
"""
click.echo(message)
- return collect_hosts(True)
+ return collect_hosts(masters_set=True)
def get_installed_hosts(hosts, callback_facts):
installed_hosts = []
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py
index 87aafe782..9cb44404c 100644
--- a/utils/test/cli_installer_tests.py
+++ b/utils/test/cli_installer_tests.py
@@ -628,6 +628,9 @@ class AttendedCliTests(OOCliFixture):
if ssh_user:
inputs.append(ssh_user)
+ if variant_num:
+ inputs.append(str(variant_num)) # Choose variant + version
+
if hosts:
i = 0
for (host, is_master) in hosts:
@@ -640,9 +643,6 @@ class AttendedCliTests(OOCliFixture):
inputs.append('n') # Done adding hosts
i += 1
- if variant_num:
- inputs.append(str(variant_num)) # Choose variant + version
-
# TODO: support option 2, fresh install
if add_nodes:
inputs.append('1') # Add more nodes