def collect_master_lb(hosts):
 message = "\nSetting up high-availability masters requires a load balancing solution.\nPlease provide the FQDN of a host that will be configured as a proxy. This\ncan be either an existing load balancer configured to balance all masters on\nport 8443 or a new host that will have HAProxy installed on it.\n\nIf the host provided is not yet configured, a reference HAProxy load\nbalancer will be installed. It's important to note that while the rest of the\nenvironment will be fault-tolerant, this reference load balancer will not be.\nIt can be replaced post-installation with a load balancer with the same\nhostname.\n"
 click.echo(message)
 host_props = {}
 def validate_prompt_lb(hostname):
  hostname = validate_prompt_hostname(hostname)
  for host in hosts:
   if ((host.connect_to == hostname) and (host.is_master() or host.is_node())):
    raise click.BadParameter(('Cannot re-use "%s" as a load balancer, please specify a separate host' % hostname))
  return hostname
 lb_hostname = click.prompt('Enter hostname or IP address', value_proc=validate_prompt_lb)
 if lb_hostname:
  host_props['connect_to'] = lb_hostname
  install_haproxy = click.confirm('Should the reference HAProxy load balancer be installed on this host?')
  host_props['preconfigured'] = (not install_haproxy)
  host_props['roles'] = ['master_lb']
  return Host(**host_props)
 else:
  return None

def collect_master_lb ( hosts ) : message = "\nSetting up high-availability masters requires a load balancing solution.\nPlease provide the FQDN of a host that will be configured as a proxy. This\ncan be either an existing load balancer configured to balance all masters on\nport 8443 or a new host that will have HAProxy installed on it.\n\nIf the host provided is not yet configured, a reference HAProxy load\nbalancer will be installed. It's important to note that while the rest of the\nenvironment will be fault-tolerant, this reference load balancer will not be.\nIt can be replaced post-installation with a load balancer with the same\nhostname.\n" click . echo ( message ) host_props = { } def validate_prompt_lb ( hostname ) : hostname = validate_prompt_hostname ( hostname ) for host in hosts : if ( ( host . connect_to == hostname ) and ( host . is_master ( ) or host . is_node ( ) ) ) : raise click . BadParameter ( ( 'Cannot re-use "%s" as a load balancer, please specify a separate host' % hostname ) ) return hostname lb_hostname = click . prompt ( 'Enter hostname or IP address' , value_proc = validate_prompt_lb ) if lb_hostname : host_props [ 'connect_to' ] = lb_hostname install_haproxy = click . confirm ( 'Should the reference HAProxy load balancer be installed on this host?' ) host_props [ 'preconfigured' ] = ( not install_haproxy ) host_props [ 'roles' ] = [ 'master_lb' ] return Host ( ** host_props ) else : return None
get a valid load balancer from the user and append it to the list of hosts .