From e204f16e5f3ca238a9c8157fab7ba673efb71db9 Mon Sep 17 00:00:00 2001 From: Nate Johnston Date: Mon, 27 Jan 2020 18:04:52 -0500 Subject: [PATCH] Fix kill-script This change squashes two changes that are being backported from the tripleo-ansible repo. They are to the same file, which was relocated to tripleo-ansible between Train and Ussuri. Change https://review.opendev.org/703123: In the kill-script there is a string "Unknown action ${SIG} for ${$CT_NAME} ${CT_ID}" which results in a "bad substitution" error, as there is no variable named with what the contents of the CT_NAME environment variable contains. Remove the extraneous '$'. Change https://review.opendev.org/703128: The reason bug #1860155 was triggered was because the kill script did not have a stanza for handling the signal that was passed in, which is signal 15. Since signal 15 is unhandled, keepalived processes will still stick around. Add handling for signal 15. Change-Id: Ib47fc73b498b6366efa4ae5b16855bd45cb3ec91 Fixes-Bug: #1860155 --- deployment/neutron/kill-script | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/deployment/neutron/kill-script b/deployment/neutron/kill-script index fe1147131b..a918d8c03c 100644 --- a/deployment/neutron/kill-script +++ b/deployment/neutron/kill-script @@ -40,9 +40,13 @@ kill_container() { $CLI rm $2 } -hup_container() { - add_date "Sending HUP signal to $1 ($2)" - $CLI kill --signal HUP $2 +signal_container() { + SIGNAL=$3 + if [ -z "$SIGNAL" ]; then + SIGNAL="HUP" + fi + add_date "Sending signal '$SIGNAL' to $1 ($2)" + $CLI kill --signal $SIGNAL $2 } {% raw -%} @@ -53,13 +57,16 @@ if [ -f /proc/$PID/cgroup ]; then case $SIG in HUP) - hup_container $CT_NAME $CT_ID + signal_container $CT_NAME $CT_ID ;; 9) kill_container $CT_NAME $CT_ID ;; + 15) + signal_container $CT_NAME $CT_ID + ;; *) - add_date "Unknown action ${SIG} for ${$CT_NAME} ${CT_ID}" + add_date "Unknown action ${SIG} for ${CT_NAME} ${CT_ID}" exit 1 ;; esac