Skip to content

Commit

Permalink
refactor: allow usage of the same variable to disable docker pulls
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Apr 23, 2018
1 parent 985887e commit 3e16586
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config
Expand Up @@ -11,6 +11,8 @@ export PLUGIN_DATA_HOST_ROOT=$ELASTICSEARCH_HOST_ROOT
export PLUGIN_DATASTORE_PORTS=(9200 9300)
export PLUGIN_DATASTORE_WAIT_PORT=9200
export PLUGIN_DEFAULT_ALIAS="ELASTICSEARCH"
export PLUGIN_DISABLE_PULL=${ELASTICSEARCH_DISABLE_PULL:=}
export PLUGIN_DISABLE_PULL_VARIABLE="ELASTICSEARCH_DISABLE_PULL"
export PLUGIN_ALT_ALIAS="DOKKU_ELASTICSEARCH"
export PLUGIN_IMAGE=$ELASTICSEARCH_IMAGE
export PLUGIN_IMAGE_VERSION=$ELASTICSEARCH_IMAGE_VERSION
Expand Down
4 changes: 2 additions & 2 deletions functions
Expand Up @@ -27,8 +27,8 @@ service_create() {
service_parse_args "${@:2}"

if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
if [[ "$ELASTICSEARCH_DISABLE_PULL" == "true" ]]; then
dokku_log_warn "ELASTICSEARCH_DISABLE_PULL environment variable detected. Not running pull command." 1>&2
if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
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 "$PLUGIN_SERVICE service creation failed"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions install
Expand Up @@ -5,8 +5,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
plugin-install() {
pull-docker-image() {
declare IMAGE="$1"
if [[ "$ELASTICSEARCH_DISABLE_PULL" == "true" ]]; then
echo " ! ELASTICSEARCH_DISABLE_PULL environment variable detected. Not running pull command." 1>&2
if [[ "$PLUGIN_DISABLE_PULL" == "true" ]]; then
echo " ! ${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
echo " ! docker pull ${IMAGE}" 1>&2
return
fi
Expand Down

0 comments on commit 3e16586

Please sign in to comment.