strip inline comments from CHECKS and Procfile. closes #2044

This commit is contained in:
Michael Hobbs
2016-03-29 16:14:08 -07:00
parent 6ed457d1f7
commit 7e1516bdf5
5 changed files with 28 additions and 15 deletions

View File

@@ -311,16 +311,17 @@ get_app_running_container_ids() {
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
local name; local command;
verify_app_name "$APP"
if [[ -f $DOKKU_PROCFILE ]]; then
local line; local name; local command
while read line || [[ -n "$line" ]]; do
if [[ -z "$line" ]] || [[ "$line" == "#"* ]]; then
continue
fi
local name="${line%%:*}"
local command="${line#*:[[:space:]]}"
line=$(strip_inline_comments "$line")
name="${line%%:*}"
command="${line#*:[[:space:]]}"
[[ "$name" == "$PROC_TYPE" ]] && echo "$command" && break
done < "$DOKKU_PROCFILE"
fi
@@ -689,3 +690,11 @@ get_json_keys() {
cat | python -c 'import json,sys;obj=json.load(sys.stdin);print " ".join(obj'"${JSON_NODE}"'.keys())';
fi
}
strip_inline_comments() {
declare desc="removes bash-style comment from input line"
local line="$1"
local stripped_line="${line%[[:space:]]#*}"
echo "$stripped_line"
}