bugfix: make type actually work with --state absent

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2014-02-01 22:46:36 +01:00
parent ab3b151918
commit 3a57367e7e
2 changed files with 8 additions and 10 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
#
#
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)

View file

@ -0,0 +1 @@
present