aboutsummaryrefslogtreecommitdiffstats
path: root/mcp
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-01-07 19:22:18 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-01-08 00:43:52 +0100
commit5f1f119d8043793821b89e61a0830ce8505635ab (patch)
treec1e25f893e246b3a5dbda2bc827aec10d3e1cf7c /mcp
parentf9202ee594ddbc9b316c45e3bbedd5c330f3f0c3 (diff)
lib.sh: Fix stop condition in wait_for
Change-Id: Ida693b6dd328db283d6992ac33500f4dd1a73eb8 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> (cherry picked from commit 717cb4e0f8d9e430eb31ba643f95682f1592e509)
Diffstat (limited to 'mcp')
-rw-r--r--mcp/scripts/lib.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 210288022..1c51ece15 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -436,7 +436,7 @@ function wait_for {
local total_attempts=$1; shift
local cmdstr=$*
local sleep_time=10
- echo "[wait_for] Waiting for cmd to return success: ${cmdstr}"
+ echo -e "\n[wait_for] Waiting for cmd to return success: ${cmdstr}"
# shellcheck disable=SC2034
for attempt in $(seq "${total_attempts}"); do
echo "[wait_for] Attempt ${attempt}/${total_attempts%.*} for: ${cmdstr}"
@@ -444,11 +444,11 @@ function wait_for {
# shellcheck disable=SC2015
eval "${cmdstr}" && echo "[wait_for] OK: ${cmdstr}" && return 0 || true
else
- ( eval "${cmdstr}" || echo __fuel_wf_failure__ ) |& tee /dev/stderr | \
- grep -Eq '(Not connected|No response|__fuel_wf_failure__)' || \
- echo "[wait_for] OK: ${cmdstr}" && return 0
+ !(eval "${cmdstr}" || echo __fuel_wf_failure__) |& tee /dev/stderr | \
+ grep -Eq '(Not connected|No response|__fuel_wf_failure__)' && \
+ echo "[wait_for] OK: ${cmdstr}" && return 0 || true
fi
- echo -n '.'; sleep "${sleep_time}"
+ sleep "${sleep_time}"
done
echo "[wait_for] ERROR: Failed after max attempts: ${cmdstr}"
return 1