|
|
@ -232,9 +232,11 @@ def main():
|
|
|
|
remote_src = module.params['remote_src']
|
|
|
|
remote_src = module.params['remote_src']
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(src):
|
|
|
|
if not os.path.exists(src):
|
|
|
|
module.fail_json(msg="Source %s failed to transfer" % (src))
|
|
|
|
module.fail_json(msg="Source %s not found" % (src))
|
|
|
|
if not os.access(src, os.R_OK):
|
|
|
|
if not os.access(src, os.R_OK):
|
|
|
|
module.fail_json(msg="Source %s not readable" % (src))
|
|
|
|
module.fail_json(msg="Source %s not readable" % (src))
|
|
|
|
|
|
|
|
if os.path.isdir(src):
|
|
|
|
|
|
|
|
module.fail_json(msg="Remote copy does not support recurisive copy of direcory: %s" % (src))
|
|
|
|
|
|
|
|
|
|
|
|
checksum_src = module.sha1(src)
|
|
|
|
checksum_src = module.sha1(src)
|
|
|
|
checksum_dest = None
|
|
|
|
checksum_dest = None
|
|
|
@ -316,7 +318,7 @@ def main():
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.atomic_move(src, dest)
|
|
|
|
module.atomic_move(src, dest)
|
|
|
|
except IOError:
|
|
|
|
except IOError:
|
|
|
|
module.fail_json(msg="failed to copy: %s to %s" % (src, dest))
|
|
|
|
module.fail_json(msg="failed to copy: %s to %s" % (src, dest), traceback=traceback.format_exc())
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
changed = False
|
|
|
|
changed = False
|
|
|
|