forked from ungleich-public/cdist
remove parameter changing code in __key_value (fixes #114,#36)
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
344e08ddda
commit
0eda57986f
2 changed files with 35 additions and 36 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -18,18 +19,18 @@
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
key="$(cat "$__object/parameter/key")"
|
key="$__object_id"
|
||||||
|
[ -f "$__object/parameter/key" ] && key="$(cat "$__object/parameter/key")"
|
||||||
|
state_should=present
|
||||||
|
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
file="$(cat "$__object/parameter/file")"
|
file="$(cat "$__object/parameter/file")"
|
||||||
delimiter="$(cat "$__object/parameter/delimiter")"
|
delimiter="$(cat "$__object/parameter/delimiter")"
|
||||||
value="$(cat "$__object/parameter/value")"
|
value="$(cat "$__object/parameter/value")"
|
||||||
|
|
||||||
state_is="$(cat "$__object/explorer/state")"
|
state_is="$(cat "$__object/explorer/state")"
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
|
||||||
|
|
||||||
if [ "$state_is" = "$state_should" ]; then
|
[ "$state_is" = "$state_should" ] && exit 0
|
||||||
# nothing to do
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
absent)
|
absent)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||||
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -18,13 +19,10 @@
|
||||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
# set defaults
|
state_should=present
|
||||||
key="$(cat "$__object/parameter/key" 2>/dev/null \
|
[ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")"
|
||||||
|| echo "$__object_id" | tee "$__object/parameter/key")"
|
|
||||||
state="$(cat "$__object/parameter/state" 2>/dev/null \
|
|
||||||
|| echo "present" | tee "$__object/parameter/state")"
|
|
||||||
|
|
||||||
if [ "$state" = "present" -a ! -f "$__object/parameter/value" ]; then
|
if [ "$state_should" = "present" -a ! -f "$__object/parameter/value" ]; then
|
||||||
echo "Missing required parameter 'value'" >&2
|
echo "Missing required parameter 'value'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue