Merge pull request #342 from plietar/no-container

Don't fail if CONTAINER is inexistant.
This commit is contained in:
rhy-jot committed 2013-11-27 13:18:31 -08:00
commit c317dca558
3 files changed
+15 -10

No files matched your search

+1 -1
View File
@@ -57,7 +57,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
+14 -7
View File
@@ -13,11 +13,14 @@ case "$1" in
fi fi
pluginhook pre-delete $APP pluginhook pre-delete $APP
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER") if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
ID=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker stop $ID > /dev/null
docker rm $ID > /dev/null
fi
docker stop $ID > /dev/null
docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null & docker images | grep $IMAGE | awk '{print $3}' | xargs docker rmi &> /dev/null &
docker rm $ID > /dev/null
pluginhook post-delete $APP pluginhook post-delete $APP
;; ;;
@@ -33,10 +36,14 @@ case "$1" in
exit 1 exit 1
fi fi
CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER) if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
docker logs $CONTAINER | tail -n 100 CONTAINER=$(<$DOKKU_ROOT/$APP/CONTAINER)
if [[ $3 == "-t" ]]; then docker logs $CONTAINER | tail -n 100
docker attach $CONTAINER if [[ $3 == "-t" ]]; then
docker attach $CONTAINER
fi
else
echo "Application's container not found"
fi fi
;; ;;
-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