Fix kill-script search string to match any "/libpod-"
In order to find the container hash, the "/proc/$PID/cgroup" file will return several lines, some of them with the patterns: .*/libpod-<container_ID>.scope .*/libpod-conmon-<container_ID>.scope The search pattern should look for "/libpod-" and the rest of the expression will extract the container ID. That will prevent the issue reported in the related bug, when the "pids:..." line does not contain this information. Change-Id: I0c017d022fbad9a8f99e5f27a7245f84de483950 Closes-Bug: #1990990
This commit is contained in:
parent
cc42cc51e9
commit
3e983806e0
@ -48,7 +48,7 @@ delete_container() {
|
||||
{% raw -%}
|
||||
if [ -f /proc/$PID/cgroup ]; then
|
||||
# Get container ID based on process cgroups
|
||||
CT_ID=$(awk 'BEGIN {FS=".scope|-"} /0::|:pids:/ {if ($(NF-1)) print $(NF-1);exit}' /proc/$PID/cgroup)
|
||||
CT_ID=$(awk 'BEGIN {FS=".scope|-"} /\/libpod-/ {if ($(NF-1)) print $(NF-1);exit}' /proc/$PID/cgroup)
|
||||
CT_NAME=$($CLI inspect -f '{{.Name}}' $CT_ID)
|
||||
|
||||
case $SIG in
|
||||
|
Loading…
Reference in New Issue
Block a user