def _get_server_health_option(config):
 for monitor in config['healthmonitors']:
  if ((monitor['status'] == ACTIVE) and monitor['admin_state_up']):
   break
 else:
  return ('', [])
 server_addon = (' check inter %(delay)ds fall %(max_retries)d' % monitor)
 opts = [('timeout check %ds' % monitor['timeout'])]
 if (monitor['type'] in (constants.HEALTH_MONITOR_HTTP, constants.HEALTH_MONITOR_HTTPS)):
  opts.append(('option httpchk %(http_method)s %(url_path)s' % monitor))
  opts.append(('http-check expect rstatus %s' % '|'.join(_expand_expected_codes(monitor['expected_codes']))))
 if (monitor['type'] == constants.HEALTH_MONITOR_HTTPS):
  opts.append('option ssl-hello-chk')
 return (server_addon, opts)

def _get_server_health_option ( config ) : for monitor in config [ 'healthmonitors' ] : if ( ( monitor [ 'status' ] == ACTIVE ) and monitor [ 'admin_state_up' ] ) : break else : return ( '' , [ ] ) server_addon = ( ' check inter %(delay)ds fall %(max_retries)d' % monitor ) opts = [ ( 'timeout check %ds' % monitor [ 'timeout' ] ) ] if ( monitor [ 'type' ] in ( constants . HEALTH_MONITOR_HTTP , constants . HEALTH_MONITOR_HTTPS ) ) : opts . append ( ( 'option httpchk %(http_method)s %(url_path)s' % monitor ) ) opts . append ( ( 'http-check expect rstatus %s' % '|' . join ( _expand_expected_codes ( monitor [ 'expected_codes' ] ) ) ) ) if ( monitor [ 'type' ] == constants . HEALTH_MONITOR_HTTPS ) : opts . append ( 'option ssl-hello-chk' ) return ( server_addon , opts )
return the first active health option .