From 0a98abbffadbc8a0c2bdbe087fdbef025cfd4f0a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 11 Mar 2014 15:39:08 +0100 Subject: [PATCH] add messaging support for __key_value Signed-off-by: Nico Schottelius --- cdist/conf/type/__key_value/gencode-remote | 5 ++++- cdist/conf/type/__key_value/man.text | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__key_value/gencode-remote b/cdist/conf/type/__key_value/gencode-remote index b79d9688..e1041a02 100755 --- a/cdist/conf/type/__key_value/gencode-remote +++ b/cdist/conf/type/__key_value/gencode-remote @@ -1,7 +1,7 @@ #!/bin/sh # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) -# 2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2012-2014 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -42,12 +42,14 @@ cp -p "$file" "\$tmpfile" sed '/^$key\($delimiter\+\)/d' "$file" > "\$tmpfile" mv -f "\$tmpfile" "$file" DONE + echo "remove" >> "$__messages_out" ;; present) case "$state_is" in absent) # add new key and value printf 'echo "%s%s%s" >> "%s"' "$key" "$delimiter" "$value_escaped" "$file" + echo "add" >> "$__messages_out" ;; wrongvalue) # change exisiting value @@ -58,6 +60,7 @@ cp -p "$file" "\$tmpfile" sed "s|^$key\($delimiter\+\).*|$key\\1$value_escaped|" "$file" > "\$tmpfile" mv -f "\$tmpfile" "$file" DONE + echo "changevalue" >> "$__messages_out" ;; *) echo "Unknown explorer state: $state_is" >&2 diff --git a/cdist/conf/type/__key_value/man.text b/cdist/conf/type/__key_value/man.text index 1423fc7d..7def7139 100644 --- a/cdist/conf/type/__key_value/man.text +++ b/cdist/conf/type/__key_value/man.text @@ -32,6 +32,15 @@ key:: value:: The value for the key. Optional if state=absent, required otherwise. +MESSAGES +-------- +create:: + Added key and value +change:: + Changed value of existing key +remove:: + Removed existing key and value + EXAMPLES --------