make the show-status script fail on errors
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
BASEPATH="$(dirname "$0")"
|
||||
@@ -7,39 +8,41 @@ IFS=':' read -ra parts <<< $COMPOSE_FILE
|
||||
|
||||
blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml")
|
||||
|
||||
# Flag to track if any invocation failed
|
||||
any_failure=false
|
||||
|
||||
for part in "${parts[@]}"; do
|
||||
include=true
|
||||
for word in "${blacklist[@]}"; do
|
||||
if echo "$part" | grep -qE "$word"; then
|
||||
#echo "The path $path contains a blacklisted word: $word"
|
||||
include=false
|
||||
fi
|
||||
if echo "$part" | grep -qE "$word"; then
|
||||
include=false
|
||||
fi
|
||||
done
|
||||
|
||||
# Check if any parameters were passed
|
||||
if [ $# -gt 0 ]; then
|
||||
# Put parameters into an array (list)
|
||||
params=("$@")
|
||||
# Put parameters into an array (list)
|
||||
params=("$@")
|
||||
|
||||
# Check if a string is part of the list
|
||||
if [[ " ${params[@]} " =~ " $1 " ]]; then
|
||||
include=$include # don't change anything
|
||||
else
|
||||
include=false
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if a string is part of the list
|
||||
if [[ " ${params[@]} " =~ " ${part%.yml} " ]]; then
|
||||
include=$include # don't change anything
|
||||
else
|
||||
include=false
|
||||
fi
|
||||
fi
|
||||
|
||||
if $include; then
|
||||
result=$($BASEPATH/sync-status.sh "${part%.yml}")
|
||||
#if [ "$1" = "${part%.yml}" ]; then
|
||||
# echo "${result}"
|
||||
# exit 0
|
||||
#else
|
||||
echo "${part%.yml}: $result"
|
||||
#fi
|
||||
result=$($BASEPATH/sync-status.sh "${part%.yml}")
|
||||
if [ $? -ne 0 ]; then
|
||||
any_failure=true
|
||||
fi
|
||||
|
||||
echo "${part%.yml}: $result"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
# If any invocation failed, return a failure exit code
|
||||
if $any_failure; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user