refactor: allow usage of the same variable to disable docker pulls

This commit is contained in:
Jose Diaz-Gonzalez
2018-04-23 06:56:51 -04:00
parent ff7acc44df
commit 8a9efd8f62
3 changed files with 6 additions and 4 deletions

2
config
View File

@@ -11,6 +11,8 @@ export PLUGIN_DATA_HOST_ROOT=$POSTGRES_HOST_ROOT
export PLUGIN_DATASTORE_PORTS=(5432) export PLUGIN_DATASTORE_PORTS=(5432)
export PLUGIN_DATASTORE_WAIT_PORT=5432 export PLUGIN_DATASTORE_WAIT_PORT=5432
export PLUGIN_DEFAULT_ALIAS="DATABASE" export PLUGIN_DEFAULT_ALIAS="DATABASE"
export PLUGIN_DISABLE_PULL=${POSTGRES_DISABLE_PULL:=}
export PLUGIN_DISABLE_PULL_VARIABLE="POSTGRES_DISABLE_PULL"
export PLUGIN_ALT_ALIAS="DOKKU_POSTGRES" export PLUGIN_ALT_ALIAS="DOKKU_POSTGRES"
export PLUGIN_IMAGE=$POSTGRES_IMAGE export PLUGIN_IMAGE=$POSTGRES_IMAGE
export PLUGIN_IMAGE_VERSION=$POSTGRES_IMAGE_VERSION export PLUGIN_IMAGE_VERSION=$POSTGRES_IMAGE_VERSION

View File

@@ -30,8 +30,8 @@ service_create() {
service_parse_args "${@:2}" service_parse_args "${@:2}"
if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
if [[ "$POSTGRES_DISABLE_PULL" == "true" ]]; then if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
dokku_log_warn "POSTGRES_DISABLE_PULL environment variable detected. Not running pull command." 1>&2 dokku_log_warn "${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
dokku_log_warn " docker pull ${IMAGE}" 1>&2 dokku_log_warn " docker pull ${IMAGE}" 1>&2
dokku_log_warn "$PLUGIN_SERVICE service creation failed" dokku_log_warn "$PLUGIN_SERVICE service creation failed"
exit 1 exit 1

View File

@@ -5,8 +5,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
plugin-install() { plugin-install() {
pull-docker-image() { pull-docker-image() {
declare IMAGE="$1" declare IMAGE="$1"
if [[ "$POSTGRES_DISABLE_PULL" == "true" ]]; then if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
echo " ! POSTGRES_DISABLE_PULL environment variable detected. Not running pull command." 1>&2 echo " ! ${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
echo " ! docker pull ${IMAGE}" 1>&2 echo " ! docker pull ${IMAGE}" 1>&2
return return
fi fi