mac-address-set: add timeout to wait_on function

if a device is never getting ready on startup sequence, the wait_on()
function runs forever. with this patch it aborts after 10 seconds.

BugzID: 77171

Signed-off-by: Patrick Zysset <patrick.zysset@netmodule.com>
This commit is contained in:
Patrick Zysset 2022-01-25 18:17:23 +01:00
parent 197b4f6f07
commit 2173bda09c
1 changed files with 8 additions and 1 deletions

View File

@ -66,8 +66,15 @@ wait_on() {
fi
log_info "$device not ready"
log_info "Waiting...."
wait_timeout=0
while ! $cmd "$device" > /dev/null 2>/dev/null; do
sleep 1
if [ $wait_timeout -gt 10 ]; then
log_warning "Timeout after 10 seconds, exiting now.."
break
else
sleep 1
fi
wait_timeout=$(($wait_timeout+1))
done
log_info "$device ready"
}