From f82c4dc6694bf63fc1fcb868126b28c855ca108e Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 14 Oct 2013 21:17:59 +0200 Subject: [PATCH] no late delete Signed-off-by: Steven Armstrong --- cdist/conf/type/__file/gencode-remote | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cdist/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote index 09f8e018..2e7ca633 100755 --- a/cdist/conf/type/__file/gencode-remote +++ b/cdist/conf/type/__file/gencode-remote @@ -62,24 +62,15 @@ case "$state_should" in destination_upload="$(cat "$__object/files/destination_upload")" set_attributes=1 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 -destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")" -mv "$destination" "\$destination_old" +rm -rf "$destination" DONE fi - # move our upload into place cat << DONE mv "$destination_upload" "$destination" DONE - - if [ "$type" = "directory" ]; then - # delete the legacy directory - cat << DONE -rm -rf "\$destination_old" -DONE - fi fi # Note: Mode - needs to happen last as a chown/chgrp can alter mode by @@ -96,7 +87,6 @@ DONE ;; absent) - # FIXME: only delete if it's a file? or no matter what? if [ "$type" = "file" ]; then echo rm -f \"$destination\" fi