Copy module: Extended error handling and fixed error messages
This commit is contained in:
parent
3d5e517007
commit
e83b5db724
1 changed files with 9 additions and 5 deletions
|
@ -66,11 +66,15 @@ 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
|
# raise an error if copy has no permission on dest
|
||||||
if not os.access(dest, os.W_OK):
|
if not os.access(dest, os.W_OK):
|
||||||
exit_kv(rc=1, failed=1, msg="Destination %s seems not writable" % (dest))
|
exit_kv(rc=1, failed=1, msg="Destination %s not writable" % (dest))
|
||||||
elif not os.access(dest, os.R_OK):
|
elif not os.access(dest, os.R_OK):
|
||||||
exit_kv(rc=1, failed=1, msg="Destination %s seems not readable" % (dest))
|
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
|
||||||
|
|
Loading…
Reference in a new issue