Merge pull request #528 from ungleich/consul_improvements

consul: add http check; add new version
This commit is contained in:
Darko Poljak 2017-06-01 09:00:16 +02:00 committed by GitHub
commit 1545d9f018
7 changed files with 25 additions and 5 deletions

View File

@ -0,0 +1 @@
283033689 36101209 consul

View File

@ -0,0 +1 @@
https://releases.hashicorp.com/consul/0.8.1/consul_0.8.1_linux_amd64.zip

View File

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
scientific|centos|redhat|ubuntu|debian|archlinux|gentoo)
scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
# any linux should work
:
;;

View File

@ -23,7 +23,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
scientific|centos|debian|redhat|ubuntu)
scientific|centos|debian|devuan|redhat|ubuntu)
# whitelist safeguard
:
;;
@ -215,7 +215,11 @@ case "$os" in
esac
;;
ubuntu)
init_upstart
;;
devuan)
init_sysvinit debian
;;
ubuntu)
init_upstart
;;
esac

View File

@ -24,6 +24,9 @@ OPTIONAL PARAMETERS
check-interval
the interval in which the script given with --check-script should be run
check-http
the URL to check for HTTP 200-ish status every --check-interval
check-script
the shell command to run every --check-interval

View File

@ -32,6 +32,10 @@ if [ -f "$__object/parameter/check-script" -a ! -f "$__object/parameter/check-in
echo "When using --check-script you must also define --check-interval" >&2
exit 1
fi
if [ -f "$__object/parameter/check-http" -a ! -f "$__object/parameter/check-interval" ]; then
echo "When using --check-http you must also define --check-interval" >&2
exit 1
fi
# Generate json config file
(
@ -52,6 +56,12 @@ for param in $(ls "$__object/parameter/"); do
printf ' "ttl": "%s"\n' "$(cat "$__object/parameter/check-ttl")"
printf ' }\n'
;;
check-http)
printf ' ,"check": {\n'
printf ' "http": "%s"\n' "$(cat "$__object/parameter/check-http")"
printf ' ,"interval": "%s"\n' "$(cat "$__object/parameter/check-interval")"
printf ' }\n'
;;
tag)
# create json array from newline delimited file
tags="$(awk '{printf "\""$1"\","}' "$__object/parameter/tag")"

View File

@ -1,3 +1,4 @@
check-http
check-interval
check-script
check-ttl