diff options
author | Michele Baldessari <michele@acksyn.org> | 2017-05-04 11:46:45 +0200 |
---|---|---|
committer | Michele Baldessari <michele@acksyn.org> | 2017-05-08 10:40:14 +0200 |
commit | 43b33c7ed8ae2b02dc552767eaa7eb1dec4fb2e1 (patch) | |
tree | daea4c1a9548262512ee739af70ccd8366d6c30f | |
parent | c224a4c7c9441e9ed0481bdeebcf65fee5d998bc (diff) |
Fix up pacemaker_status test in yum_update.sh
In change I2aae4e2fdfec526c835f8967b54e1db3757bca17 we did the
following:
-pacemaker_status=$(systemctl is-active pacemaker || :)
+pacemaker_status=""
+if hiera -c /etc/puppet/hiera.yaml service_names | grep -q pacemaker;
then
+ pacemaker_status=$(systemctl is-active pacemaker)
+fi
we did that so due to LP#1668266: we did not want systemctl is-active to
fail on non pacemaker nodes. The problem with the above hiera check is
that it will match on pacemaker_remote nodes as well.
We cannot piggyback the pacemaker_enabled hiera key because that is true
on all nodes. So let's make the test check only for pacemaker service
without matching pacemaker remote. Tested with:
1) Test on a controller node with pacemaker service enabled
[root@overcloud-controller-0 ~]# hiera -c /etc/puppet/hiera.yaml -a service_names |grep '\bpacemaker\b'
"pacemaker",
[root@overcloud-controller-0 ~]# echo $?
0
2) Test on a compute node without pacemaker:
[root@overcloud-novacompute-0 puppet]# hiera -c /etc/puppet/hiera.yaml service_names |grep '\bpacemaker\b'
[root@overcloud-novacompute-0 puppet]# echo $?
1
3) Test on a node with pacemaker_remote in the service_names key:
[root@overcloud-novacompute-0 puppet]# hiera -c /etc/puppet/hiera.yaml service_names |grep '\bpacemaker\b'
[root@overcloud-novacompute-0 puppet]# echo $?
1
[root@overcloud-novacompute-0 puppet]# hiera -c /etc/puppet/hiera.yaml service_names |grep '\bpacemaker_remote\b'
"pacemaker_remote"]
[root@overcloud-novacompute-0 puppet]# echo $?
0
NB: cherry-pick was not 100% clean due to unrelated lines being cleaned
up in master.
Change-Id: I54c5756ba6dea791aef89a79bc0b538ba02ae48a
Closes-Bug: #1688214
(cherry picked from commit 2244290424ffa7781fb5b64688908c218cd10ecd)
-rwxr-xr-x | extraconfig/tasks/yum_update.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh index bab67e01..0ca12ffb 100755 --- a/extraconfig/tasks/yum_update.sh +++ b/extraconfig/tasks/yum_update.sh @@ -39,7 +39,8 @@ fi touch "$timestamp_file" pacemaker_status="" -if hiera -c /etc/puppet/hiera.yaml service_names | grep -q pacemaker; then +# We include word boundaries in order to not match pacemaker_remote +if hiera -c /etc/puppet/hiera.yaml service_names | grep -q '\bpacemaker\b'; then pacemaker_status=$(systemctl is-active pacemaker) fi @@ -78,7 +79,6 @@ elif [[ "$check_update_exit" != "100" ]]; then exit 0 fi - # TODO: FIXME: remove this in Pike. # Hack around mod_ssl update and puppet https://bugs.launchpad.net/tripleo/+bug/1682448 touch /etc/httpd/conf.d/ssl.conf |