diff options
author | Michele Baldessari <michele@acksyn.org> | 2016-11-15 11:25:38 +0100 |
---|---|---|
committer | Michele Baldessari <michele@acksyn.org> | 2016-11-15 11:25:38 +0100 |
commit | bb3c742e36ac86ed41a7705aec05adbaf62098f6 (patch) | |
tree | ec02c223f438e6c1b14fcfa1049a1221812ed9bf /extraconfig | |
parent | f7cf9d8fc13f5fd47e4115f5749a60f2452cd53d (diff) |
Fix external Load Balancer deployment
Deployments using external LB will file like this:
deploy_stderr: |
+ RESTART_FOLDER=/var/lib/tripleo/pacemaker-restarts
+ [[ -d /var/lib/tripleo/pacemaker-restarts ]]
++ systemctl is-active haproxy
+ haproxy_status=unknown
deploy_status_code: 3
openstack software deployment show 4f339ca4-7600-4ca0-b0ef-f798bc47b6cf
The reason is that via https://review.openstack.org/#/c/393644/ we
introducted the haproxy restart like this:
haproxy_status=$(systemctl is-active haproxy)
if [ "$haproxy_status" = "active" ]; then
systemctl reload haproxy
fi
The problem is that if haproxy is not running/installed systemctl
is-active can fail and the script will terminate with an error return
code. Let's just move the call inside the if so the script does not fail
in case haproxy is not there.
The snippet before the change (on a system without haproxy installed):
[root@mrg-09 tmp]# ./test.sh
++ systemctl is-active haproxy
+ haproxy_status=unknown
[root@mrg-09 tmp]# echo $?
3
After this change:
[root@mrg-09 tmp]# ./test.sh
++ systemctl is-active haproxy
+ '[' unknown = active ']'
[root@mrg-09 tmp]# echo $?
0
Change-Id: I837c63a9dbcde8c922f843c442974fa79cf1eede
Closes-Bug: #1641904
Diffstat (limited to 'extraconfig')
-rwxr-xr-x | extraconfig/tasks/pacemaker_resource_restart.sh | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/extraconfig/tasks/pacemaker_resource_restart.sh b/extraconfig/tasks/pacemaker_resource_restart.sh index 8500bcef..49d39bc8 100755 --- a/extraconfig/tasks/pacemaker_resource_restart.sh +++ b/extraconfig/tasks/pacemaker_resource_restart.sh @@ -28,7 +28,6 @@ if [[ -d "$RESTART_FOLDER" && -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; fi -haproxy_status=$(systemctl is-active haproxy) -if [ "$haproxy_status" = "active" ]; then +if [ $(systemctl is-active haproxy) = "active" ]; then systemctl reload haproxy fi |