From f5d6110a79ca11f00728429660428ab99f5292d1 Mon Sep 17 00:00:00 2001 From: Damien Ciabrini Date: Thu, 18 Apr 2019 15:29:33 +0200 Subject: [PATCH] Fix keepalived VIP monitoring script Currently keepalived monitors VIPs by running some shell commands that target HAProxy. The generated shell command is invalid, which makes keepalived log errors. Tue Apr 16 11:55:57 2019: Command = '/usr/bin/test' '-S' '/var/lib/haproxy/stats' '&&' 'echo' 'show' Tue Apr 16 11:55:57 2019: Script `haproxy` now returning 2 Tue Apr 16 11:55:57 2019: VRRP_Script(haproxy) failed (exited with status 2) Fix quoting and invoke /bin/sh explicitely to fix the error: Thu Apr 18 13:16:35 2019: Command = '/usr/bin/sh' '-c' 'test -S /var/lib/haproxy/stats && echo show info | socat /var/lib/haproxy/stats stdio' Thu Apr 18 13:16:35 2019: VRRP_Script(haproxy) succeeded Change-Id: I5a757f88963270e77c8ec411cd292a30f89c6bc0 Closes-Bug: #1825366 --- manifests/keepalived.pp | 2 +- spec/classes/tripleo_keepalive_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/keepalived.pp b/manifests/keepalived.pp index 94145cd11..c2c660c28 100644 --- a/manifests/keepalived.pp +++ b/manifests/keepalived.pp @@ -99,7 +99,7 @@ class tripleo::keepalived ( case $::osfamily { 'RedHat': { $keepalived_name_is_process = false - $keepalived_vrrp_script = 'test -S /var/lib/haproxy/stats && echo "show info" | socat /var/lib/haproxy/stats stdio' + $keepalived_vrrp_script = '/bin/sh -c \'test -S /var/lib/haproxy/stats && echo show info | socat /var/lib/haproxy/stats stdio\'' } # RedHat 'Debian': { $keepalived_name_is_process = true diff --git a/spec/classes/tripleo_keepalive_spec.rb b/spec/classes/tripleo_keepalive_spec.rb index 43c0a4182..bdffad9d8 100644 --- a/spec/classes/tripleo_keepalive_spec.rb +++ b/spec/classes/tripleo_keepalive_spec.rb @@ -202,7 +202,7 @@ describe 'tripleo::keepalived' do case facts[:osfamily] when 'RedHat' { :name_is_process => 'false', - :vrrp_script => 'test -S /var/lib/haproxy/stats && echo "show info" | socat /var/lib/haproxy/stats stdio' } + :vrrp_script => "/bin/sh -c 'test -S /var/lib/haproxy/stats && echo show info | socat /var/lib/haproxy/stats stdio'" } when 'Debian' { :name_is_process => 'true', :vrrp_script => nil }