From ef98c54989cc8577e49582e7d7f3a6e529ce11dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCrlimann?= Date: Fri, 14 Aug 2015 22:54:55 +0200 Subject: [PATCH 1/8] Added retry-join-wan to consul parameters --- cdist/conf/type/__consul_agent/manifest | 6 ++++++ cdist/conf/type/__consul_agent/parameter/optional_multiple | 1 + 2 files changed, 7 insertions(+) diff --git a/cdist/conf/type/__consul_agent/manifest b/cdist/conf/type/__consul_agent/manifest index f8cace94..9dd51b28 100755 --- a/cdist/conf/type/__consul_agent/manifest +++ b/cdist/conf/type/__consul_agent/manifest @@ -109,6 +109,12 @@ for param in $(ls "$__object/parameter/"); do # remove trailing , printf ' ,"retry_join": [%s]\n' "${retry_join%*,}" ;; + retry-join-wan) + # join multiple parameters into json array over wan + retry_join_wan="$(awk '{printf "\""$1"\","}' "$__object/parameter/retry-join-wan")" + # remove trailing , + printf ' ,"retry_join_wan": [%s]\n' "${retry_join_wan%*,}" + ;; bootstrap-expect) # integer key=value parameters key="$(echo "$param" | tr '-' '_')" diff --git a/cdist/conf/type/__consul_agent/parameter/optional_multiple b/cdist/conf/type/__consul_agent/parameter/optional_multiple index 12cd064c..740e4d7f 100644 --- a/cdist/conf/type/__consul_agent/parameter/optional_multiple +++ b/cdist/conf/type/__consul_agent/parameter/optional_multiple @@ -1 +1,2 @@ retry-join +retry-join-wan From 0057ee5558327342ff6cbd4048474cbe6cb5fdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCrlimann?= Date: Sat, 15 Aug 2015 22:04:27 +0200 Subject: [PATCH 2/8] Added new version for consul --- cdist/conf/type/__consul/files/versions/0.5.2/cksum | 1 + cdist/conf/type/__consul/files/versions/0.5.2/source | 1 + 2 files changed, 2 insertions(+) create mode 100644 cdist/conf/type/__consul/files/versions/0.5.2/cksum create mode 100644 cdist/conf/type/__consul/files/versions/0.5.2/source diff --git a/cdist/conf/type/__consul/files/versions/0.5.2/cksum b/cdist/conf/type/__consul/files/versions/0.5.2/cksum new file mode 100644 index 00000000..1c077266 --- /dev/null +++ b/cdist/conf/type/__consul/files/versions/0.5.2/cksum @@ -0,0 +1 @@ +2207534901 18245010 consul diff --git a/cdist/conf/type/__consul/files/versions/0.5.2/source b/cdist/conf/type/__consul/files/versions/0.5.2/source new file mode 100644 index 00000000..991034ce --- /dev/null +++ b/cdist/conf/type/__consul/files/versions/0.5.2/source @@ -0,0 +1 @@ +https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip From 7de303147c972a7432cdf3178d56e1a0f23dc8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCrlimann?= Date: Fri, 14 Aug 2015 22:54:55 +0200 Subject: [PATCH 3/8] Added retry-join-wan to consul parameters From 90f3f81c390492d558d08e746fe8a43d3f2f686f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=BCrlimann?= Date: Fri, 28 Aug 2015 01:25:05 +0200 Subject: [PATCH 4/8] Added advertise-wan as optional parameter for consul --- cdist/conf/type/__consul_agent/parameter/optional | 1 + 1 file changed, 1 insertion(+) diff --git a/cdist/conf/type/__consul_agent/parameter/optional b/cdist/conf/type/__consul_agent/parameter/optional index 8940023d..37aad8c1 100644 --- a/cdist/conf/type/__consul_agent/parameter/optional +++ b/cdist/conf/type/__consul_agent/parameter/optional @@ -17,3 +17,4 @@ key-file-source node-name user state +advertise-wan From ed75374b9509b948e320cf6442a629df2b33dee9 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 15 Oct 2015 10:12:11 -0500 Subject: [PATCH 5/8] support NetBSD in __timezone type --- cdist/conf/type/__timezone/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__timezone/manifest b/cdist/conf/type/__timezone/manifest index 3bcb05c6..9b0cce73 100755 --- a/cdist/conf/type/__timezone/manifest +++ b/cdist/conf/type/__timezone/manifest @@ -34,7 +34,7 @@ case "$os" in __package timezone export require="__package/timezone" ;; - freebsd) + freebsd|netbsd) # whitelist : ;; From 185d7f593a01bd62dcec0c3f358103fba9ec9890 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 15 Oct 2015 10:22:46 -0500 Subject: [PATCH 6/8] Treat NetBSD the same as FreeBSD and OpenBSD in 'stat' explorers --- cdist/conf/type/__ccollect_source/explorer/stat | 2 +- cdist/conf/type/__directory/explorer/stat | 2 +- cdist/conf/type/__file/explorer/stat | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__ccollect_source/explorer/stat b/cdist/conf/type/__ccollect_source/explorer/stat index 7c86d94f..9b5ad75b 100755 --- a/cdist/conf/type/__ccollect_source/explorer/stat +++ b/cdist/conf/type/__ccollect_source/explorer/stat @@ -25,7 +25,7 @@ destination="/$__object_id" os=$("$__explorer/os") case "$os" in - "freebsd"|"openbsd") + "freebsd"|"netbsd"|"openbsd") # FIXME: should be something like this based on man page, but can not test stat -f "type: %ST owner: %Du %Su diff --git a/cdist/conf/type/__directory/explorer/stat b/cdist/conf/type/__directory/explorer/stat index 077aa43b..41bc8b04 100755 --- a/cdist/conf/type/__directory/explorer/stat +++ b/cdist/conf/type/__directory/explorer/stat @@ -25,7 +25,7 @@ destination="/$__object_id" os=$("$__explorer/os") case "$os" in - "freebsd"|"openbsd") + "freebsd"|"netbsd"|"openbsd") # FIXME: should be something like this based on man page, but can not test stat -f "type: %ST owner: %Du %Su diff --git a/cdist/conf/type/__file/explorer/stat b/cdist/conf/type/__file/explorer/stat index 00e34cca..8a917556 100755 --- a/cdist/conf/type/__file/explorer/stat +++ b/cdist/conf/type/__file/explorer/stat @@ -25,7 +25,7 @@ destination="/$__object_id" os=$("$__explorer/os") case "$os" in - "freebsd"|"openbsd") + "freebsd"|"netbsd"|"openbsd") # FIXME: should be something like this based on man page, but can not test stat -f "type: %ST owner: %Du %Su From cef2b32663edc4d6902a5d5016578061b3501d62 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 15 Oct 2015 10:42:11 -0500 Subject: [PATCH 7/8] don't use the non-existant gshadow database on NetBSD either --- cdist/conf/type/__group/explorer/gshadow | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cdist/conf/type/__group/explorer/gshadow b/cdist/conf/type/__group/explorer/gshadow index 8d40e9e0..2e2ab29d 100755 --- a/cdist/conf/type/__group/explorer/gshadow +++ b/cdist/conf/type/__group/explorer/gshadow @@ -24,9 +24,11 @@ name=$__object_id os="$($__explorer/os)" -if [ "$os" = "freebsd" ]; then - echo "FreeBSD does not have getent gshadow" - exit 0 -fi +case "$os" in + "freebsd"|"netbsd") + echo "$os does not have getent gshadow" + exit 0 + ;; +esac getent gshadow "$name" || true From 90fe1bf6c94f231d8a78fd7daaa6dd5dae313e30 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 15 Oct 2015 10:53:56 -0500 Subject: [PATCH 8/8] add some NetBSD support in __user_groups --- cdist/conf/type/__user_groups/explorer/group | 2 +- cdist/conf/type/__user_groups/explorer/oldusermod | 7 +++++++ cdist/conf/type/__user_groups/gencode-remote | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__user_groups/explorer/group b/cdist/conf/type/__user_groups/explorer/group index a8cb63af..5bad9a0b 100755 --- a/cdist/conf/type/__user_groups/explorer/group +++ b/cdist/conf/type/__user_groups/explorer/group @@ -20,4 +20,4 @@ user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" -(id --groups --name "$user" | tr ' ' '\n' | sort) 2>/dev/null || true +(id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true diff --git a/cdist/conf/type/__user_groups/explorer/oldusermod b/cdist/conf/type/__user_groups/explorer/oldusermod index 6ef25b13..bf43fcec 100644 --- a/cdist/conf/type/__user_groups/explorer/oldusermod +++ b/cdist/conf/type/__user_groups/explorer/oldusermod @@ -18,4 +18,11 @@ # along with cdist. If not, see . # +os="$($__explorer/os)" + +if [ "$os" = "netbsd" ]; then + echo netbsd + exit +fi + usermod --help | grep -q -- '-A group' && echo true || echo false diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote index 65404bfc..8b13f32c 100755 --- a/cdist/conf/type/__user_groups/gencode-remote +++ b/cdist/conf/type/__user_groups/gencode-remote @@ -21,8 +21,14 @@ user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" state_should="$(cat "$__object/parameter/state")" oldusermod="$(cat "$__object/explorer/oldusermod")" +os=$(cat "$__global/explorer/os") -if [ "$oldusermod" = "true" ]; then +if [ "$os" = "netbsd" ]; then + # NetBSD does not have a command to remove a user from a group + oldusermod="true" + addparam="-G" + delparam=";;#" +elif [ "$oldusermod" = "true" ]; then addparam="-A" delparam="-R" else