updated dokku ls output with container status

This commit is contained in:
Michael Hobbs
2015-04-24 10:49:18 -07:00
parent 39dd4fc700
commit e9663caf5c
2 changed files with 18 additions and 15 deletions

View File

@@ -111,18 +111,21 @@ case "$1" in
ls)
dokku_apps=$(ls -d $DOKKU_ROOT/*/ 2>/dev/null) || (echo "You haven't deployed any applications yet" && exit 1)
dokku_3col_log_info2_quiet "App Name" "Container Type" "Container Id"
dokku_col_log_info1_quiet "App Name" "Container Type" "Container Id" "Status"
for dokku_app in $dokku_apps; do
APP=$(basename $dokku_app)
DOKKU_APP_CIDS=$(get_container_ids $APP)
DOCKER_RUNNING_CONTAINERS=$(docker ps -q --no-trunc)
if [[ -n $DOKKU_APP_CIDS ]]; then
for DOKKU_APP_CID in $DOKKU_APP_CIDS; do
DOKKU_APP_CONTAINER_STATUS="stopped"
[[ $DOCKER_RUNNING_CONTAINERS =~ $DOKKU_APP_CID ]] && DOKKU_APP_CONTAINER_STATUS="running"
DOKKU_APP_CONTAINER_TYPE=$(grep -l $DOKKU_APP_CID $DOKKU_ROOT/$APP/CONTAINER.* | awk -F. '{ print $2 }')
dokku_3col_log_msg "$APP" "$DOKKU_APP_CONTAINER_TYPE" "$DOKKU_APP_CID"
dokku_col_log_msg "$APP" "$DOKKU_APP_CONTAINER_TYPE" "${DOKKU_APP_CID:0:12}" "$DOKKU_APP_CONTAINER_STATUS"
done
else
dokku_3col_log_msg "$APP" "NOT_DEPLOYED" "NOT_DEPLOYED"
dokku_col_log_msg "$APP" "NOT_DEPLOYED" "NOT_DEPLOYED" "NOT_DEPLOYED"
fi
done
;;

View File

@@ -33,37 +33,37 @@ dokku_log_info2_quiet() {
fi
}
dokku_3col_log_info1() {
printf "%-30s %-30s %-30s\n" "-----> $@"
dokku_col_log_info1() {
printf "%-25s %-25s %-25s %-25s\n" "-----> $@"
}
dokku_3col_log_info1_quiet() {
dokku_col_log_info1_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-30s %-30s %-30s\n" "-----> $@"
printf "%-25s %-25s %-25s %-25s\n" "-----> $@"
else
return 0
fi
}
dokku_3col_log_info2() {
printf "%-30s %-30s %-30s\n" "=====> $@"
dokku_col_log_info2() {
printf "%-25s %-25s %-25s %-25s\n" "=====> $@"
}
dokku_3col_log_info2_quiet() {
dokku_col_log_info2_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-30s %-30s %-30s\n" "=====> $@"
printf "%-25s %-25s %-25s %-25s\n" "=====> $@"
else
return 0
fi
}
dokku_3col_log_msg() {
printf "%-30s %-30s %-30s\n" "$@"
dokku_col_log_msg() {
printf "%-25s %-25s %-25s %-25s\n" "$@"
}
dokku_3col_log_msg_quiet() {
dokku_col_log_msg_quiet() {
if [[ -z "$DOKKU_QUIET_OUTPUT" ]];then
printf "%-30s %-30s %-30s\n" "$@"
printf "%-25s %-25s %-25s %-25s\n" "$@"
else
return 0
fi