Merge branch 'bugfix__directory' of https://github.com/dheule/cdist
This commit is contained in:
commit
fccdcd768d
1 changed files with 18 additions and 7 deletions
|
@ -56,15 +56,18 @@ 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,16 +89,23 @@ 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
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
if [ "$type" = "directory" ]; then
|
if [ "$type" = "directory" ]; then
|
||||||
echo rm -rf \"$destination\"
|
echo rm -rf \"$destination\"
|
||||||
fi
|
echo remove >> "$__messages_out"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state_should" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
|
|
Loading…
Reference in a new issue