1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added to copy module: Error handling for missing permissions on the copy destination

This commit is contained in:
Ingo Gottwald 2012-06-23 21:39:37 +02:00
parent 618924a24f
commit 270266e920

View file

@ -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):