Fix sending SIGTERM to the sidecar containers

This is "repeat" of the Nate's fix done for stable/train branch in
[1].
This patch had got one issue - it missed passing "15" signal to the
signal_container() function and due to that e.g. keepalived sidecar
container wasn't never killed when router was deleted.

Patch [1] was recently removed with patch [2] so now I need to get it
back in the kill-script.

New version of the kill-script is in tripleo-ansible in the
tripleo-systemd-wrapper role where all is done fine and "15" signal is
passed properly to the signal_container() function.

[1] https://review.opendev.org/#/c/704463/
[2] https://review.opendev.org/#/c/724843/

Change-Id: I3f18922cf58bf8359f27aebf295bdb131bf2333a
Closes-bz: #1839071
This commit is contained in:
Slawek Kaplonski 2020-05-26 11:57:26 +02:00
parent 4bb977425c
commit e3331ea725
1 changed files with 12 additions and 5 deletions

View File

@ -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 15
;;
*)
add_date "Unknown action ${SIG} for ${$CT_NAME} ${CT_ID}"
add_date "Unknown action ${SIG} for ${CT_NAME} ${CT_ID}"
exit 1
;;
esac