Fix formating template and --output-map begin added at each rendering
This commit is contained in:
parent
5af628ac7f
commit
52acc19da2
9
ctctl
9
ctctl
|
@ -571,7 +571,7 @@ ctctl_render_templates(){
|
|||
# This is used for two things
|
||||
# - Add the consul.suffix to every files (except job files). This allows ctctl to simply infer the policy name from the file name
|
||||
# - Put job files in the current dir for conveniance, and everything else in the output dir
|
||||
GOMPLATE_OUT_ARGS+=(--output-map)
|
||||
local GOMPLATE_OUT_ARGS=(--output-map)
|
||||
GOMPLATE_OUT_ARGS+=('[[ if (regexp.Match ".*\\.nomad(\\.hcl)?" .in) ]][[ .in ]][[ else ]]output/[[ .in | path.Dir ]]/[[ .in | path.Base | regexp.Replace "^([^\\.]+)\\.(.*)$" (printf "%s%s.%s" "$1" .ctx.consul.suffix "$2") ]][[ end ]]')
|
||||
|
||||
echo
|
||||
|
@ -663,7 +663,6 @@ ctctl_render_templates(){
|
|||
gomplate "${GOMPLATE_COMMON_ARGS[@]}" --context ${VAR_FILES} -f ${CONFIG} -o ${CONFIG}
|
||||
# Render it twice so we can reference 2 levels of templates in variables
|
||||
gomplate "${GOMPLATE_COMMON_ARGS[@]}" --context ${VAR_FILES} -f ${CONFIG} -o ${CONFIG}
|
||||
#GOMPLATE_COMMON_ARGS+=(--context .=file://${CONFIG})
|
||||
|
||||
# First, cleanup any previously rendered files
|
||||
rm -rf bundles/${NAME}/example/*
|
||||
|
@ -682,10 +681,10 @@ ctctl_render_templates(){
|
|||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Format example job files
|
||||
find ./bundles/${NAME}/example -maxdepth 1 -type f \( -name \*nomad.hcl -o -name \*.nomad \) -exec nomad fmt {} \;
|
||||
# Format example job files
|
||||
find ./bundles/${NAME}/example -maxdepth 1 -type f \( -name \*nomad.hcl -o -name \*.nomad \) -exec nomad fmt {} \;
|
||||
fi
|
||||
|
||||
rm -f ${CONFIG}
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue