Merge pull request #1224 from weilaaa/add_error_msg_when_wait_file_timeout

add error message when wait file exist timeout
This commit is contained in:
karmada-bot 2022-01-07 16:17:48 +08:00 committed by GitHub
commit 1a058b8e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -222,7 +222,7 @@ function util::wait_for_condition() {
local timeout=${3:-}
local start_msg="Waiting for ${msg}"
local error_msg="[ERROR] Timeout waiting for ${msg}"
local error_msg="[ERROR] Timeout waiting for condition ${msg}"
local counter=0
while ! eval ${condition}; do
@ -251,12 +251,14 @@ function util::wait_for_condition() {
function util::wait_file_exist() {
local file_path=${1}
local timeout=${2}
local error_msg="[ERROR] Timeout waiting for file exist ${file_path}"
for ((time=0; time<${timeout}; time++)); do
if [[ -e ${file_path} ]]; then
return 0
fi
sleep 1
done
echo -e "\n${error_msg}"
return 1
}