forked from ungleich-public/cdist
Patch __consul_* to discover remote consul configuration dir
This commit is contained in:
parent
70200cd28f
commit
f595664924
18 changed files with 33 additions and 11 deletions
1
cdist/conf/type/__consul_check/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_check/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
|
||||
name="$(cat "$__object/parameter/name" 2>/dev/null || echo "$__object_id")"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="check_${name}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
15
cdist/conf/type/__consul_service/explorer/conf-dir
Normal file
15
cdist/conf/type/__consul_service/explorer/conf-dir
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Determine the configuration directory used by consul.
|
||||
|
||||
check_dir () {
|
||||
if [ -d "$1" ]; then
|
||||
echo -n "$1"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
check_dir '/etc/consul/conf.d'
|
||||
check_dir '/etc/consul.d'
|
||||
check_dir '/etc/consul'
|
||||
|
||||
echo 'Could not determine consul configuration dir. Exiting.' >&2
|
||||
exit 1
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
|
||||
name="$(cat "$__object/parameter/name" 2>/dev/null || echo "$__object_id")"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="service_${name}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
@ -45,7 +45,7 @@ printf ' "name": "%s"\n' "$name"
|
|||
cd "$__object/parameter/"
|
||||
for param in *; do
|
||||
case "$param" in
|
||||
state|name|check-interval) continue ;;
|
||||
state|name|check-interval|conf-dir) continue ;;
|
||||
check-script)
|
||||
printf ' ,"check": {\n'
|
||||
printf ' "script": "%s"\n' "$(cat "$__object/parameter/check-script")"
|
||||
|
@ -86,7 +86,6 @@ echo " }"
|
|||
# end json file
|
||||
echo "}"
|
||||
) | \
|
||||
require="__directory${conf_dir}" \
|
||||
__config_file "${conf_dir}/${conf_file}" \
|
||||
--owner root --group consul --mode 640 \
|
||||
--state "$state" \
|
||||
|
|
1
cdist/conf/type/__consul_watch_checks/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_checks/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_event/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_event/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_key/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_key/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_keyprefix/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_keyprefix/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_nodes/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_nodes/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_service/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_service/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
1
cdist/conf/type/__consul_watch_services/explorer/conf-dir
Symbolic link
1
cdist/conf/type/__consul_watch_services/explorer/conf-dir
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../__consul_service/explorer/conf-dir
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
cdist_type="${__type##*/}"
|
||||
watch_type="${cdist_type##*_}"
|
||||
conf_dir="/etc/consul/conf.d"
|
||||
conf_dir=$(cat "$__object/explorer/conf-dir")
|
||||
conf_file="watch_${watch_type}_${__object_id}.json"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
|
|
Loading…
Reference in a new issue