From 9f7038163f0c0d7ef498e9feff458968f3fbda88 Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Mon, 12 Sep 2016 00:14:30 +0200 Subject: [PATCH] file_copy: Properly apply file permissions When dst was a directory, the file would be copied properly, but the permissions would be applied to the parent directory rather than the copied file. --- bootstrapvz/plugins/file_copy/tasks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrapvz/plugins/file_copy/tasks.py b/bootstrapvz/plugins/file_copy/tasks.py index 484bdab..c353db3 100644 --- a/bootstrapvz/plugins/file_copy/tasks.py +++ b/bootstrapvz/plugins/file_copy/tasks.py @@ -69,4 +69,9 @@ class FileCopyCommand(Task): else: shutil.copytree(src_path, final_destination) - modify_path(info, file_entry['dst'], file_entry) + if os.path.isfile(src_path) and os.path.isdir(final_destination): + dst = os.path.join(final_destination, os.path.basename(src_path)) + else: + dst = final_destination + + modify_path(info, dst, file_entry)