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

This commit is contained in:
Nico Schottelius 2014-01-10 11:25:56 +01:00
commit d8f39f3903
2 changed files with 24 additions and 7 deletions

View file

@ -2,6 +2,7 @@
# #
# 2011-2013 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)
# 2014 Daniel Heule (hda at sfs.biz)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -73,14 +74,15 @@ set_mode() {
case "$state_should" in case "$state_should" in
present) present)
if [ "$type" != "directory" ]; then if [ "$type" != "directory" ]; then
# our destination is not a directory, remove whatever is there
# and then create our directory and set all attributes
set_attributes=1 set_attributes=1
cat << DONE if [ "$type" != "none" ]; then
rm -f "$destination" # our destination is not a directory, remove whatever is there
mkdir $mkdiropt "$destination" # and then create our directory and set all attributes
DONE echo rm -f "\"$destination\""
echo "remove non directory" >> "$__messages_out" echo "remove non directory" >> "$__messages_out"
fi
echo "mkdir $mkdiropt \"$destination\""
echo "create" >> "$__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

View file

@ -46,6 +46,21 @@ recursive::
If supplied the chgrp and chown call will run recursively. If supplied the chgrp and chown call will run recursively.
This does *not* influence the behaviour of chmod. This does *not* influence the behaviour of chmod.
MESSAGES
--------
chgrp <group>::
Changed group membership
chown <owner>::
Changed owner
chmod <mode>::
Changed mode
create::
Empty directory was created
remove::
Directory exists, but state is absent, directory will be removed by generated code.
remove non directory::
Someting other than a directory with the same name exists and was removed prior to create.
EXAMPLES EXAMPLES
-------- --------