Commit 62a36b67 by Michael DeHaan

Merge pull request #504 from gottwald/devel-copyfix

Copy module: Error handling for missing permissions on the copy destination.
parents 53360d6c e83b5db7
...@@ -66,6 +66,16 @@ if dest: ...@@ -66,6 +66,16 @@ if dest:
if not os.path.exists(src): if not os.path.exists(src):
exit_kv(rc=1, failed=1, msg="Source %s failed to transfer" % (src)) exit_kv(rc=1, failed=1, msg="Source %s failed to transfer" % (src))
if os.path.exists(dest):
# 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 not writable" % (dest))
elif not os.access(dest, os.R_OK):
exit_kv(rc=1, failed=1, msg="Destination %s not readable" % (dest))
else:
if not os.access(os.path.dirname(dest), os.W_OK):
exit_kv(rc=1, failed=1, msg="Destination %s not writable" % (dest))
md5sum = None md5sum = None
changed = False changed = False
if os.path.exists(dest): if os.path.exists(dest):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment