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 #!/bin/sh
# #
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -17,7 +18,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
#
if [ -f "$__object/parameter/name" ]; then if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")" name="$(cat "$__object/parameter/name")"
@ -25,21 +25,18 @@ else
name="$__object_id" name="$__object_id"
fi fi
parameter_state="$__object/parameter/state" state_should="$(cat "$__object/parameter/state")"
if [ -f "$_parameter_state" ]; then
state_should=$(cat "$__object/parameter/state")
else
state_should="present"
fi
runs="$(cat "$__object/explorer/runs")" if [ -s "$__object/explorer/runs" ]; then
if [ "$runs" ]; then
state_is="present" state_is="present"
else else
state_is="absent" state_is="absent"
fi fi
[ "$state_is" = "$state_should" ] && exit 0 if [ "$state_is" = "$state_should" ]; then
# nothing to do
exit 0
fi
case "$state_should" in case "$state_should" in
present) present)

View file

@ -0,0 +1 @@
present