Merge "Allow to create loadbalancer with chinese character" into stable/queens

This commit is contained in:
Zuul 2019-08-01 10:14:29 +00:00 committed by Gerrit Code Review
commit c626bf6efe
4 changed files with 8 additions and 9 deletions

View File

@ -255,7 +255,7 @@ def _transform_loadbalancer(loadbalancer, haproxy_base_dir):
pools = [_transform_pool(x) for x in loadbalancer.pools] pools = [_transform_pool(x) for x in loadbalancer.pools]
connection_limit = _compute_global_connection_limit(listeners) connection_limit = _compute_global_connection_limit(listeners)
return { return {
'name': loadbalancer.name, 'id': loadbalancer.id,
'vip_address': loadbalancer.vip_address, 'vip_address': loadbalancer.vip_address,
'connection_limit': connection_limit, 'connection_limit': connection_limit,
'listeners': listeners, 'listeners': listeners,

View File

@ -14,7 +14,7 @@
# #
#} #}
{% extends 'haproxy_proxies.j2' %} {% extends 'haproxy_proxies.j2' %}
{% set loadbalancer_name = loadbalancer.name %} {% set loadbalancer_id = loadbalancer.id %}
{% set usergroup = user_group %} {% set usergroup = user_group %}
{% set sock_path = stats_sock %} {% set sock_path = stats_sock %}
{% set connection_limit = loadbalancer.connection_limit %} {% set connection_limit = loadbalancer.connection_limit %}

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
# #
#} #}
# Configuration for {{ loadbalancer_name }} # Configuration for {{ loadbalancer_id }}
global global
daemon daemon
user nobody user nobody

View File

@ -101,21 +101,21 @@ RET_LISTENER_TLS_SNI = {
'sni_containers': [RET_SNI_CONT_1, RET_SNI_CONT_2]} 'sni_containers': [RET_SNI_CONT_1, RET_SNI_CONT_2]}
RET_LB = { RET_LB = {
'name': 'test-lb', 'id': 'sample_loadbalancer_id_1',
'vip_address': '10.0.0.2', 'vip_address': '10.0.0.2',
'listeners': [RET_LISTENER], 'listeners': [RET_LISTENER],
'connection_limit': RET_LISTENER['connection_limit'], 'connection_limit': RET_LISTENER['connection_limit'],
'pools': [RET_POOL]} 'pools': [RET_POOL]}
RET_LB_TLS = { RET_LB_TLS = {
'name': 'test-lb', 'id': 'sample_loadbalancer_id_1',
'vip_address': '10.0.0.2', 'vip_address': '10.0.0.2',
'listeners': [RET_LISTENER_TLS], 'listeners': [RET_LISTENER_TLS],
'connection_limit': RET_LISTENER_TLS['connection_limit'], 'connection_limit': RET_LISTENER_TLS['connection_limit'],
'pools': [RET_POOL]} 'pools': [RET_POOL]}
RET_LB_TLS_SNI = { RET_LB_TLS_SNI = {
'name': 'test-lb', 'id': 'sample_loadbalancer_id_1',
'vip_address': '10.0.0.2', 'vip_address': '10.0.0.2',
'listeners': [RET_LISTENER_TLS_SNI], 'listeners': [RET_LISTENER_TLS_SNI],
'connection_limit': RET_LISTENER_TLS_SNI['connection_limit'], 'connection_limit': RET_LISTENER_TLS_SNI['connection_limit'],
@ -126,11 +126,10 @@ def sample_loadbalancer_tuple(proto=None, monitor=True, persistence=True,
persistence_type=None, tls=False, sni=False): persistence_type=None, tls=False, sni=False):
proto = 'HTTP' if proto is None else proto proto = 'HTTP' if proto is None else proto
in_lb = collections.namedtuple( in_lb = collections.namedtuple(
'loadbalancer', 'id, name, vip_address, protocol, vip_port, ' 'loadbalancer', 'id, vip_address, protocol, vip_port, '
'listeners, pools') 'listeners, pools')
return in_lb( return in_lb(
id='sample_loadbalancer_id_1', id='sample_loadbalancer_id_1',
name='test-lb',
vip_address='10.0.0.2', vip_address='10.0.0.2',
protocol=proto, protocol=proto,
vip_port=sample_vip_port_tuple(), vip_port=sample_vip_port_tuple(),
@ -311,7 +310,7 @@ def sample_base_expected_config(backend, frontend=None,
constants.PROTOCOL_TERMINATED_HTTPS: https_tls_frontend constants.PROTOCOL_TERMINATED_HTTPS: https_tls_frontend
} }
frontend = fe_mapper[fe_proto] frontend = fe_mapper[fe_proto]
return ("# Configuration for test-lb\n" return ("# Configuration for sample_loadbalancer_id_1\n"
"global\n" "global\n"
" daemon\n" " daemon\n"
" user nobody\n" " user nobody\n"