feat: allow disabling chown for persistent storage in scheduler-docker-local

Some systems - such as a mounted read-only CIFS filesystem - do not fully support chown, and chowning should be considered optional for cases when the host os has already taken care of permissioning. This commit allows users to disable chown by setting a property on the scheduler-docker-local plugin.
This commit is contained in:
Jose Diaz-Gonzalez committed 2018-08-01 06:51:47 -04:00
1 parent 53c5d548f1
commit 7349c30cd9
10 files changed
+196 -7

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
cmd-scheduler-docker-local-help "scheduler-docker-local:help"
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-scheduler-docker-local-report "$@"
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
fn-in-array() {
declare desc="return true if value ($1) is in list (all other arguments)"
local e
for e in "${@:2}"; do
[[ "$e" == "$1" ]] && return 0
done
return 1
}
scheduler-docker-local-set-cmd() {
declare desc="set or clear a scheduler-docker-local property for an app"
local cmd="scheduler-docker-local:set" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("disable-chown")
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
dokku_log_fail "Invalid key specified, valid keys include: disable-chown"
fi
if [[ -n "$VALUE" ]]; then
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
fn-plugin-property-write "scheduler-docker-local" "$APP" "$KEY" "$VALUE"
else
dokku_log_info2_quiet "Unsetting ${KEY}"
fn-plugin-property-delete "scheduler-docker-local" "$APP" "$KEY"
fi
}
scheduler-docker-local-set-cmd "$@"