Remove remaining direct dokku calls

This commit is contained in:
Jose Diaz-Gonzalez
2016-05-16 00:23:51 -04:00
parent 9216488fb3
commit 6090fa6aa6
5 changed files with 56 additions and 41 deletions

View File

@@ -9,26 +9,7 @@ postgres-create-cmd() {
local cmd="$PLUGIN_COMMAND_PREFIX:create" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
declare SERVICE="$1"
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
[[ ! -d "$PLUGIN_DATA_ROOT/$SERVICE" ]] || dokku_log_fail "$PLUGIN_SERVICE service $2 already exists"
SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; LINKS_FILE="$SERVICE_ROOT/LINKS"
if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q " $PLUGIN_IMAGE_VERSION " ; then
docker pull "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION" || dokku_log_fail "$PLUGIN_SERVICE image $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION pull failed"
fi
mkdir -p "$SERVICE_ROOT" || dokku_log_fail "Unable to create service directory"
password=$(openssl rand -hex 16)
echo "$password" > "$SERVICE_ROOT/PASSWORD"
chmod 640 "$SERVICE_ROOT/PASSWORD"
touch "$LINKS_FILE"
if [[ -n $POSTGRES_CUSTOM_ENV ]]; then
echo "$POSTGRES_CUSTOM_ENV" | tr ';' "\n" > "$SERVICE_ROOT/ENV"
else
echo "" > "$SERVICE_ROOT/ENV"
fi
service_create_container "$SERVICE"
service_create "$SERVICE"
}
postgres-create-cmd "$@"