Remove now useless sudo call for port check

Back then, the "sudo" was needed because healthchecks were running as
root, using a paunch created systemd unit/timer calling "podman exec
--user root".

Now that we're using native healthchecks, we can get rid of the sudo
call, since it's already using as the intended user.

Closes-Bug: #1940068

Change-Id: I7eaabc91005952aa956456944c46224f08f4c7f8
This commit is contained in:
Cédric Jeanneret 2021-08-17 11:51:20 +02:00
parent 1a6d0d8013
commit 36a7a4d093
1 changed files with 1 additions and 2 deletions

View File

@ -51,7 +51,6 @@ healthcheck_port () {
shift 1
ports=""
puser=$(get_user_from_process $process)
# First convert port to hex value. We need to 0-pad it in order to get the
# right format (4 chars).
for p in $@; do
@ -76,7 +75,7 @@ healthcheck_port () {
match=0
for pid in $(pgrep -f $process); do
# Here, we check if a socket is actually associated to the process PIDs
match=$(( $match+$(sudo -u $puser find /proc/$pid/fd/ -ilname "socket*" -printf "%l\n" 2>/dev/null | grep -c -E "(${sockets})") ))
match=$(( $match+$(find /proc/$pid/fd/ -ilname "socket*" -printf "%l\n" 2>/dev/null | grep -c -E "(${sockets})") ))
test $match -gt 0 && exit 0 # exit as soon as we get a match
done
exit 1 # no early exit, meaning failure.