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 a365e541a4
commit 3ffaf2d78f
1 changed files with 9 additions and 7 deletions

View File

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