From 23674ef59589b884d399c5c0c57f30f2baf5b89e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 27 Nov 2015 10:38:23 -0400 Subject: Print a system summary after adding each. --- utils/src/ooinstall/cli_installer.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index ec9ccb565..56bb75187 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -14,6 +14,7 @@ from ooinstall.variants import find_variant, get_variant_version_combos DEFAULT_ANSIBLE_CONFIG = '/usr/share/atomic-openshift-utils/ansible.cfg' DEFAULT_PLAYBOOK_DIR = '/usr/share/ansible/openshift-ansible/' +MIN_MASTERS_FOR_HA = 3 def validate_ansible_dir(path): if not path: @@ -79,7 +80,6 @@ def collect_hosts(version=None, masters_set=False, print_summary=True): Returns: a list of host information collected from the user """ - min_masters_for_ha = 3 click.clear() click.echo('*** Host Configuration ***') message = """ @@ -126,7 +126,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen host_props['master'] = True num_masters += 1 - if num_masters >= min_masters_for_ha or version == '3.0': + if num_masters >= MIN_MASTERS_FOR_HA or version == '3.0': masters_set = True host_props['node'] = True @@ -145,13 +145,9 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen hosts.append(host) if print_summary: - click.echo('') - click.echo('Current Masters: {}'.format(num_masters)) - click.echo('Current Nodes: {}'.format(len(hosts))) - click.echo('Additional Masters required for HA: {}'.format(max(min_masters_for_ha - num_masters, 0))) - click.echo('') + print_host_summary(hosts) - if num_masters <= 1 or num_masters >= min_masters_for_ha: + if num_masters <= 1 or num_masters >= MIN_MASTERS_FOR_HA: more_hosts = click.confirm('Do you want to add additional hosts?') if num_masters > 1: @@ -159,6 +155,22 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen return hosts + +def print_host_summary(hosts): + masters = [host for host in hosts if host.master] + nodes = [host for host in hosts if host.node] + click.echo('') + click.echo('Current Masters: %s' % len(masters)) + for host in masters: + click.echo(' %s' % host.connect_to) + click.echo('Current Nodes: %s' % len(nodes)) + for host in nodes: + click.echo(' %s' % host.connect_to) + click.echo('Additional Masters required for HA: %s' % + max(MIN_MASTERS_FOR_HA - len(masters), 0)) + click.echo('') + + def collect_master_lb(hosts): """ Get a valid load balancer from the user and append it to the list of -- cgit v1.2.3