Replace union to create tcp-check list for redis

When using union, repeated arrays members are removed, so in this case
we are missing a 'expect string +ok' after the QUIT. To avoid that i'm
usinhg + operator to join arrays.

Change-Id: I8f92469aa8dd0b8c21821b3ec62b2d43361ee428
(cherry picked from commit 3130cc880a)
This commit is contained in:
Alfredo Moralejo 2020-09-02 16:32:21 +02:00
parent 819c2592bf
commit f716ef5a85
1 changed files with 9 additions and 7 deletions

View File

@ -1535,18 +1535,20 @@ class tripleo::haproxy (
} else {
$redis_tcp_check_password_options = []
}
$redis_tcp_check_options = union($redis_tcp_check_ssl_options, $redis_tcp_check_password_options)
$redis_tcp_check_connect_options = union($redis_tcp_check_ssl_options, $redis_tcp_check_password_options)
$redis_tcp_check_common_options = ['send PING\r\n',
'expect string +PONG',
'send info\ replication\r\n',
'expect string role:master',
'send QUIT\r\n',
'expect string +OK']
$redis_tcp_check_options = $redis_tcp_check_connect_options + $redis_tcp_check_common_options
haproxy::listen { 'redis':
bind => $redis_bind_opts,
options => {
'balance' => 'first',
'option' => [ 'tcp-check', 'tcplog', ],
'tcp-check' => union($redis_tcp_check_options, ['send PING\r\n',
'expect string +PONG',
'send info\ replication\r\n',
'expect string role:master',
'send QUIT\r\n',
'expect string +OK']),
'tcp-check' => $redis_tcp_check_options,
},
collect_exported => false,
}