Merge branch 'bugfix__directory' of https://github.com/dheule/cdist

This commit is contained in:
Nico Schottelius 2014-01-08 14:50:09 +01:00
commit fccdcd768d

View file

@ -57,14 +57,17 @@ get_current_value() {
set_group() { set_group() {
echo chgrp $recursive \"$1\" \"$destination\" echo chgrp $recursive \"$1\" \"$destination\"
echo chgrp $recursive $1 >> "$__messages_out"
} }
set_owner() { set_owner() {
echo chown $recursive \"$1\" \"$destination\" echo chown $recursive \"$1\" \"$destination\"
echo chown $recursive $1 >> "$__messages_out"
} }
set_mode() { set_mode() {
echo chmod $recursive \"$1\" \"$destination\" echo chmod $recursive \"$1\" \"$destination\"
echo chmod $recursive $1 >> "$__messages_out"
} }
case "$state_should" in case "$state_should" in
@ -77,6 +80,7 @@ case "$state_should" in
rm -f "$destination" rm -f "$destination"
mkdir $mkdiropt "$destination" mkdir $mkdiropt "$destination"
DONE DONE
echo "remove non directory" >> "$__messages_out"
fi fi
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by # Note: Mode - needs to happen last as a chown/chgrp can alter mode by
@ -85,7 +89,13 @@ DONE
if [ -f "$__object/parameter/$attribute" ]; then if [ -f "$__object/parameter/$attribute" ]; then
value_should="$(cat "$__object/parameter/$attribute")" value_should="$(cat "$__object/parameter/$attribute")"
value_is="$(get_current_value "$attribute" "$value_should")" value_is="$(get_current_value "$attribute" "$value_should")"
if [ "$set_attributes" -o "$value_should" != "$value_is" ]; then
# change 0xxx format to xxx format => same as stat returns
if [ "$attribute" = mode ]; then
value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')"
fi
if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then
"set_$attribute" "$value_should" "set_$attribute" "$value_should"
fi fi
fi fi
@ -94,6 +104,7 @@ DONE
absent) absent)
if [ "$type" = "directory" ]; then if [ "$type" = "directory" ]; then
echo rm -rf \"$destination\" echo rm -rf \"$destination\"
echo remove >> "$__messages_out"
fi fi
;; ;;
*) *)