From 5ec8ac90d9f8e5dd2cafb003e86db9f804863c8a Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Wed, 31 May 2017 18:21:24 +0200 Subject: [PATCH 1/2] consul: add http check; add new version --- cdist/conf/type/__consul/files/versions/0.8.1/cksum | 1 + cdist/conf/type/__consul/files/versions/0.8.1/source | 1 + cdist/conf/type/__consul/manifest | 2 +- cdist/conf/type/__consul_agent/manifest | 12 ++++++++---- cdist/conf/type/__consul_service/manifest | 10 ++++++++++ cdist/conf/type/__consul_service/parameter/optional | 1 + 6 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 cdist/conf/type/__consul/files/versions/0.8.1/cksum create mode 100644 cdist/conf/type/__consul/files/versions/0.8.1/source diff --git a/cdist/conf/type/__consul/files/versions/0.8.1/cksum b/cdist/conf/type/__consul/files/versions/0.8.1/cksum new file mode 100644 index 00000000..9125cc8f --- /dev/null +++ b/cdist/conf/type/__consul/files/versions/0.8.1/cksum @@ -0,0 +1 @@ +283033689 36101209 consul diff --git a/cdist/conf/type/__consul/files/versions/0.8.1/source b/cdist/conf/type/__consul/files/versions/0.8.1/source new file mode 100644 index 00000000..92386c7c --- /dev/null +++ b/cdist/conf/type/__consul/files/versions/0.8.1/source @@ -0,0 +1 @@ +https://releases.hashicorp.com/consul/0.8.1/consul_0.8.1_linux_amd64.zip diff --git a/cdist/conf/type/__consul/manifest b/cdist/conf/type/__consul/manifest index b16c5749..7d0e73c5 100755 --- a/cdist/conf/type/__consul/manifest +++ b/cdist/conf/type/__consul/manifest @@ -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 : ;; diff --git a/cdist/conf/type/__consul_agent/manifest b/cdist/conf/type/__consul_agent/manifest index 07bf3b26..64efd366 100755 --- a/cdist/conf/type/__consul_agent/manifest +++ b/cdist/conf/type/__consul_agent/manifest @@ -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 diff --git a/cdist/conf/type/__consul_service/manifest b/cdist/conf/type/__consul_service/manifest index 9ba64141..4f52d542 100755 --- a/cdist/conf/type/__consul_service/manifest +++ b/cdist/conf/type/__consul_service/manifest @@ -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")" diff --git a/cdist/conf/type/__consul_service/parameter/optional b/cdist/conf/type/__consul_service/parameter/optional index 496e31a3..2e3e8b63 100644 --- a/cdist/conf/type/__consul_service/parameter/optional +++ b/cdist/conf/type/__consul_service/parameter/optional @@ -1,3 +1,4 @@ +check-http check-interval check-script check-ttl From 06e1ddcf4712bd6ad6c759ccc43fdea2a0cb8bfe Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Wed, 31 May 2017 18:57:21 +0200 Subject: [PATCH 2/2] __consul_agent: mention http-check in man page --- cdist/conf/type/__consul_service/man.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cdist/conf/type/__consul_service/man.rst b/cdist/conf/type/__consul_service/man.rst index bcfe4067..510be3d5 100644 --- a/cdist/conf/type/__consul_service/man.rst +++ b/cdist/conf/type/__consul_service/man.rst @@ -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