parent
f5951add54
commit
f382765f29
9
abra
9
abra
@ -755,12 +755,13 @@ sub_app_list (){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local -a DEPLOYED_APPS # array
|
local -a DEPLOYED_APPS # array
|
||||||
|
local -a CHECKED_SERVERS # array
|
||||||
|
|
||||||
warning "Loading status from ${#SERVERS[@]} server(s), patience advised.."
|
warning "Loading status from ${#SERVERS[@]} server(s), patience advised.."
|
||||||
|
|
||||||
for SERVER in "${SERVERS[@]}"; do
|
for SERVER in "${SERVERS[@]}"; do
|
||||||
SERVER="${SERVER##*/}" # basename
|
SERVER="${SERVER##*/}" # basename
|
||||||
mapfile -t SERVER_APPS < <(DOCKER_CONTEXT="$SERVER" docker stack ls --format '{{ .Name }}')
|
mapfile -t SERVER_APPS < <(DOCKER_CONTEXT="$SERVER" docker stack ls --format '{{ .Name }}' 2>/dev/null)
|
||||||
# add $SERVER~ to the start of each DEPLOYED_APPS
|
# add $SERVER~ to the start of each DEPLOYED_APPS
|
||||||
DEPLOYED_APPS+=("${SERVER_APPS[@]/#/$SERVER~}")
|
DEPLOYED_APPS+=("${SERVER_APPS[@]/#/$SERVER~}")
|
||||||
done
|
done
|
||||||
@ -800,6 +801,12 @@ sub_app_list (){
|
|||||||
fi
|
fi
|
||||||
if [ -n "$STATUS" ]; then
|
if [ -n "$STATUS" ]; then
|
||||||
APP_STATUS=$( printf '%s\n' "${DEPLOYED_APPS[@]}" | grep -qP "^${SERVER}~${APP_STACK_NAME}$" && echo "deployed" || echo "inactive")
|
APP_STATUS=$( printf '%s\n' "${DEPLOYED_APPS[@]}" | grep -qP "^${SERVER}~${APP_STACK_NAME}$" && echo "deployed" || echo "inactive")
|
||||||
|
if [[ "$APP_STATUS" == "inactive" ]] && [[ ! ${CHECKED_SERVERS[*]} =~ ${SERVER} ]]; then
|
||||||
|
CHECKED_SERVERS+=("$SERVER")
|
||||||
|
if ! docker context inspect "$SERVER" > /dev/null 2>&1; then
|
||||||
|
APP_STATUS="unknown"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
printf " %s\t%s\t%s%s\n" "$DOMAIN" "$TYPE" "$SERVER" "${STATUS:+ }${APP_STATUS}"
|
printf " %s\t%s\t%s%s\n" "$DOMAIN" "$TYPE" "$SERVER" "${STATUS:+ }${APP_STATUS}"
|
||||||
done | column -s' ' -t
|
done | column -s' ' -t
|
||||||
|
Reference in New Issue
Block a user