no late delete
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
5918de368d
commit
f82c4dc669
1 changed files with 2 additions and 12 deletions
|
@ -62,24 +62,15 @@ case "$state_should" in
|
||||||
destination_upload="$(cat "$__object/files/destination_upload")"
|
destination_upload="$(cat "$__object/files/destination_upload")"
|
||||||
set_attributes=1
|
set_attributes=1
|
||||||
if [ "$type" = "directory" ]; then
|
if [ "$type" = "directory" ]; then
|
||||||
# our destination is currently a directory, move it out of the way,
|
# our destination is currently a directory, delete it
|
||||||
cat << DONE
|
cat << DONE
|
||||||
destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")"
|
rm -rf "$destination"
|
||||||
mv "$destination" "\$destination_old"
|
|
||||||
DONE
|
DONE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# move our upload into place
|
# move our upload into place
|
||||||
cat << DONE
|
cat << DONE
|
||||||
mv "$destination_upload" "$destination"
|
mv "$destination_upload" "$destination"
|
||||||
DONE
|
DONE
|
||||||
|
|
||||||
if [ "$type" = "directory" ]; then
|
|
||||||
# delete the legacy directory
|
|
||||||
cat << DONE
|
|
||||||
rm -rf "\$destination_old"
|
|
||||||
DONE
|
|
||||||
fi
|
|
||||||
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
|
||||||
|
@ -96,7 +87,6 @@ DONE
|
||||||
;;
|
;;
|
||||||
|
|
||||||
absent)
|
absent)
|
||||||
# FIXME: only delete if it's a file? or no matter what?
|
|
||||||
if [ "$type" = "file" ]; then
|
if [ "$type" = "file" ]; then
|
||||||
echo rm -f \"$destination\"
|
echo rm -f \"$destination\"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue