From 3a57367e7e895d3d4fe9fd761f0264df80aed0e3 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Sat, 1 Feb 2014 22:46:36 +0100 Subject: [PATCH] bugfix: make type actually work with --state absent Signed-off-by: Steven Armstrong --- cdist/conf/type/__process/gencode-remote | 17 +++++++---------- .../conf/type/__process/parameter/default/state | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 cdist/conf/type/__process/parameter/default/state diff --git a/cdist/conf/type/__process/gencode-remote b/cdist/conf/type/__process/gencode-remote index 41bc5381..639940d9 100755 --- a/cdist/conf/type/__process/gencode-remote +++ b/cdist/conf/type/__process/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) +# 2014 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -17,7 +18,6 @@ # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # -# if [ -f "$__object/parameter/name" ]; then name="$(cat "$__object/parameter/name")" @@ -25,21 +25,18 @@ else name="$__object_id" fi -parameter_state="$__object/parameter/state" -if [ -f "$_parameter_state" ]; then - state_should=$(cat "$__object/parameter/state") -else - state_should="present" -fi +state_should="$(cat "$__object/parameter/state")" -runs="$(cat "$__object/explorer/runs")" -if [ "$runs" ]; then +if [ -s "$__object/explorer/runs" ]; then state_is="present" else state_is="absent" fi -[ "$state_is" = "$state_should" ] && exit 0 +if [ "$state_is" = "$state_should" ]; then + # nothing to do + exit 0 +fi case "$state_should" in present) diff --git a/cdist/conf/type/__process/parameter/default/state b/cdist/conf/type/__process/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__process/parameter/default/state @@ -0,0 +1 @@ +present