do not generate code when mode = 0xxx format

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-12-04 13:37:15 +01:00
parent ed10f4e5b4
commit acd42b259b

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
# 2013 Steven Armstrong (steven-cdist armstrong.cc) # 2013 Steven Armstrong (steven-cdist armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
@ -65,12 +65,19 @@ case "$state_should" in
for attribute in group owner mode; do for attribute in group owner mode; do
if [ -f "$__object/parameter/$attribute" ]; then if [ -f "$__object/parameter/$attribute" ]; then
value_should="$(cat "$__object/parameter/$attribute")" value_should="$(cat "$__object/parameter/$attribute")"
# change 0xxx format to xxx format => same as stat returns
if [ "$attribute" = mode ]; then
value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')"
fi
value_is="$(get_current_value "$attribute" "$value_should")" value_is="$(get_current_value "$attribute" "$value_should")"
if [ -f "$__object/files/set-attributes" -o "$value_should" != "$value_is" ]; then if [ -f "$__object/files/set-attributes" -o "$value_should" != "$value_is" ]; then
"set_$attribute" "$value_should" "set_$attribute" "$value_should"
fi fi
fi fi
done done
;; ;;
absent) absent)