feat: use is_container_status everywhere

This commit is contained in:
Jose Diaz-Gonzalez
2018-02-12 02:21:34 -05:00
parent 7a6d771689
commit a8d42ea8be
3 changed files with 7 additions and 6 deletions

View File

@@ -347,8 +347,7 @@ get_app_running_container_ids() {
CIDS=$(get_app_container_ids "$APP" "$CONTAINER_TYPE")
for CID in $CIDS; do
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true)
[[ "$APP_CONTAINER_STATUS" == "true" ]] && local APP_RUNNING_CONTAINER_IDS+="$CID "
(is_container_status "$CID" "Running") && local APP_RUNNING_CONTAINER_IDS+="$CID "
done
echo "$APP_RUNNING_CONTAINER_IDS"

View File

@@ -45,8 +45,7 @@ enter_default_cmd() {
fi
fi
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist"
docker inspect -f '{{ .State.Running }}' "$ID" | grep -q "true" > /dev/null || dokku_log_fail "Container is not running"
(is_container_status "$ID" "Running") || dokku_log_fail "Container is not running"
local DOKKU_APP_SHELL="/bin/bash"
DOKKU_APP_SHELL="$(config_get --global DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")"

View File

@@ -13,8 +13,11 @@ report_single_app() {
local APP_CIDS=$(get_app_container_ids "$APP"); local PROCS=0; local RUNNING=""
for CID in $APP_CIDS; do
local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2> /dev/null || true)
if [[ "$APP_CONTAINER_STATUS" == "true" ]]; then RUNNING+="0"; else RUNNING+="1"; fi
if (is_container_status "$CID" "Running"); then
RUNNING+="0"
else
RUNNING+="1"
fi
PROCS=$((PROCS + 1))
done