Fix abra app ls --status

This commit is contained in:
3wc 2020-11-18 00:40:26 +02:00
parent c57069e0af
commit 059968a8cf

9
abra
View File

@ -451,7 +451,7 @@ sub_app_list (){
ENV_FILES=($ABRA_DIR/servers/*/*.env)
shopt -u nullglob dotglob
STATUS="${abra___status:+STATUS}"
STATUS="$( [[ $abra___status == "true" ]] && echo "Y" )"
if [ -n "$STATUS" ]; then
get_servers
@ -468,6 +468,8 @@ sub_app_list (){
done
fi
printf '%s\n' "${DEPLOYED_APPS[@]}"
printf "%s lovely apps:\n\n" "${#ENV_FILES[@]}"
for i in "${!ENV_FILES[@]}"; do
@ -492,9 +494,9 @@ sub_app_list (){
APP_STACK_NAME="${DOMAIN//./_}"
fi
if [ -n "$STATUS" ]; then
APP_STATUS=$(printf '%s\n' "${DEPLOYED_APPS[@]}" | grep -P "^${SERVER}~${APP_STACK_NAME}$" && echo "true")
APP_STATUS=$( printf '%s\n' "${DEPLOYED_APPS[@]}" | grep -qP "^${SERVER}~${APP_STACK_NAME}$" && echo "deployed" || echo "inactive")
fi
printf " %s\t%s\t%s%s\n" "$DOMAIN" "$APP" "$SERVER" "${STATUS:+ }${APP_STATUS:+deployed}"
printf " %s\t%s\t%s%s\n" "$DOMAIN" "$APP" "$SERVER" "${STATUS:+ }${APP_STATUS}"
done | column -s' ' -t
# Align table `-t` based on tab characters -s`^V<Tab>`
}
@ -679,6 +681,7 @@ sub_app_secret_insert() {
error "Required arguments missing"
fi
# shellcheck disable=SC2059
printf "$PW" | docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" - > /dev/null
if [ "$STORE_WITH_PASS" == "true" ] && type pass > /dev/null 2>&1; then