Don't fail if CONTAINER is inexistant.

This commit is contained in:
Paul Lietar committed 2013-11-22 22:58:02 +00:00
1 parent e42c028d18
commit 8a9182c859
3 files changed
+9 -4

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ case "$1" in
pluginhook pre-deploy $APP $IMAGE pluginhook pre-deploy $APP $IMAGE
# kill the app when running # kill the app when running
if [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER") oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker kill $oldid > /dev/null docker kill $oldid > /dev/null
fi fi
+8 -1
View File
@@ -13,11 +13,14 @@ case "$1" in
fi fi
pluginhook pre-delete $APP pluginhook pre-delete $APP
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER") ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null docker stop $ID > /dev/null
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
docker rm $ID > /dev/null docker rm $ID > /dev/null
fi
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
pluginhook post-delete $APP pluginhook post-delete $APP
;; ;;
@@ -33,11 +36,15 @@ case "$1" in
exit 1 exit 1
fi fi
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER) CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
docker logs $CONTAINER | tail -n 100 docker logs $CONTAINER | tail -n 100
if [[ $3 == "-t" ]]; then if [[ $3 == "-t" ]]; then
docker attach $CONTAINER docker attach $CONTAINER
fi fi
else
echo "Application's container not found"
fi
;; ;;
run) run)
-2
View File
@@ -108,7 +108,6 @@ case "$1" in
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP" APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
ENV_ADD="" ENV_ADD=""
ENV_TEMP=`cat "${ENV_FILE}"` ENV_TEMP=`cat "${ENV_FILE}"`
ID=$(< "$APP_DIR/CONTAINER")
RESTART=false RESTART=false
VARS="${*:3}" VARS="${*:3}"
@@ -151,7 +150,6 @@ case "$1" in
APP="$2"; APP_DIR="$DOKKU_ROOT/$APP" APP="$2"; APP_DIR="$DOKKU_ROOT/$APP"
ENV_TEMP=`cat "${ENV_FILE}"` ENV_TEMP=`cat "${ENV_FILE}"`
ID=$(< "$APP_DIR/CONTAINER")
VARS="${*:3}" VARS="${*:3}"
for var in $VARS; do for var in $VARS; do