remove deprecated mktemp args and name vars more clearly

This commit is contained in:
Michael Hobbs
2016-03-29 19:46:46 -07:00
parent 8a4b2f9a2e
commit 9ce7470b87
11 changed files with 46 additions and 46 deletions

View File

@@ -74,15 +74,15 @@ checks_check_deploy() {
# docker cp exits with status 1 when run as non-root user when it tries to chown the file
# after successfully copying the file. Thus, we suppress stderr.
# ref: https://github.com/dotcloud/docker/issues/3986
local TMPDIR=$(mktemp -d /tmp/dokku_CHECKS.XXXXX)
docker cp $DOKKU_APP_CONTAINER_ID:/app/CHECKS "$TMPDIR" 2> /dev/null || true
local CHECK_DEPLOY_TMP_WORK_DIR=$(mktemp -d /tmp/dokku_CHECKS.XXXXX)
docker cp $DOKKU_APP_CONTAINER_ID:/app/CHECKS "$CHECK_DEPLOY_TMP_WORK_DIR" 2> /dev/null || true
local FILENAME=${TMPDIR}/CHECKS
local FILENAME=${CHECK_DEPLOY_TMP_WORK_DIR}/CHECKS
cleanup() {
declare desc="cleans up TMPDIR and print container output"
declare desc="cleans up CHECK_DEPLOY_TMP_WORK_DIR and print container output"
local id="$1"
rm -rf "$TMPDIR"
rm -rf "$CHECK_DEPLOY_TMP_WORK_DIR" &> /dev/null || true
if [[ $id ]]; then
dokku_log_info2_quiet "$APP $DOKKU_APP_CONTAINER_TYPE container output:"
dokku_container_log_verbose_quiet "$id"
@@ -91,7 +91,7 @@ checks_check_deploy() {
}
trap 'cleanup $DOKKU_APP_CONTAINER_ID' RETURN INT TERM EXIT
if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; then
if [[ ! -s "${CHECK_DEPLOY_TMP_WORK_DIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]]; then
# We allow custom check for web instances only
if [[ "$DOKKU_APP_CONTAINER_TYPE" == "web" ]]; then
dokku_log_verbose "For more efficient zero downtime deployments, create a file CHECKS."
@@ -101,7 +101,7 @@ checks_check_deploy() {
dokku_log_verbose "Non web container detected: Running default container check..."
fi
rm -rf "$TMPDIR"
rm -rf "$CHECK_DEPLOY_TMP_WORK_DIR" &> /dev/null || true
# simple default check to see if the container stuck around
local DOKKU_DEFAULT_CHECKS_WAIT="${DOKKU_DEFAULT_CHECKS_WAIT:-10}"