From 270266e920f9072ac4ae32793743ae0e4de349dc Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Sat, 23 Jun 2012 21:39:37 +0200 Subject: [PATCH] Added to copy module: Error handling for missing permissions on the copy destination --- library/copy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/copy b/library/copy index f3f3cab6d9..0686b3994c 100755 --- a/library/copy +++ b/library/copy @@ -66,6 +66,12 @@ if dest: if not os.path.exists(src): exit_kv(rc=1, failed=1, msg="Source %s failed to transfer" % (src)) +# raise an error if copy has no permission on dest +if not os.access(dest, os.W_OK): + exit_kv(rc=1, failed=1, msg="Destination %s seems not writable" % (dest)) +elif not os.access(dest, os.R_OK): + exit_kv(rc=1, failed=1, msg="Destination %s seems not readable" % (dest)) + md5sum = None changed = False if os.path.exists(dest):