#NEWLINE# def print_installation_summary( hosts , version = None ) : #NEWLINE# #INDENT# '\n    Displays a summary of all hosts configured thus far, and what role each\n    will play.\n\n    Shows total nodes/masters, hints for performing/modifying the deployment\n    with additional setup, warnings for invalid or sub-optimal configurations.\n    ' #NEWLINE# click . clear ( ) #NEWLINE# click . echo ( '*** Installation Summary ***\n' ) #NEWLINE# click . echo ( 'Hosts:' ) #NEWLINE# for host in hosts : #NEWLINE# #INDENT# print_host_summary ( hosts , host ) #NEWLINE# #UNINDENT# masters = [ host for host in hosts if host . master ] #NEWLINE# nodes = [ host for host in hosts if host . node ] #NEWLINE# dedicated_nodes = [ host for host in hosts if ( host . node and ( not host . master ) ) ] #NEWLINE# click . echo ( '' ) #NEWLINE# click . echo ( ( 'Total OpenShift Masters: %s' % len ( masters ) ) ) #NEWLINE# click . echo ( ( 'Total OpenShift Nodes: %s' % len ( nodes ) ) ) #NEWLINE# if ( ( len ( masters ) == 1 ) and ( version != '3.0' ) ) : #NEWLINE# #INDENT# ha_hint_message = '\nNOTE: Add a total of 3 or more Masters to perform an HA installation.' #NEWLINE# click . echo ( ha_hint_message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( masters ) == 2 ) : #NEWLINE# #INDENT# min_masters_message = '\nWARNING: A minimum of 3 masters are required to perform an HA installation.\nPlease add one more to proceed.' #NEWLINE# click . echo ( min_masters_message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( masters ) >= 3 ) : #NEWLINE# #INDENT# ha_message = '\nNOTE: Multiple Masters specified, this will be an HA deployment with a separate\netcd cluster. You will be prompted to provide the FQDN of a load balancer and\na host for storage once finished entering hosts.\n' #NEWLINE# click . echo ( ha_message ) #NEWLINE# dedicated_nodes_message = '\nWARNING: Dedicated Nodes are recommended for an HA deployment. If no dedicated\nNodes are specified, each configured Master will be marked as a schedulable\nNode.' #NEWLINE# min_ha_nodes_message = '\nWARNING: A minimum of 3 dedicated Nodes are recommended for an HA\ndeployment.' #NEWLINE# if ( len ( dedicated_nodes ) == 0 ) : #NEWLINE# #INDENT# click . echo ( dedicated_nodes_message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( dedicated_nodes ) < 3 ) : #NEWLINE# #INDENT# click . echo ( min_ha_nodes_message ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# click . echo ( '' )