Merge pull request #733 from willthames/copy_to_directory
Allow copy dest argument to be a directory
This commit is contained in:
commit
92ab23d0da
1 changed files with 3 additions and 0 deletions
3
copy
3
copy
|
@ -45,6 +45,9 @@ def main():
|
||||||
module.fail_json(msg="Destination %s not writable" % (dest))
|
module.fail_json(msg="Destination %s not writable" % (dest))
|
||||||
if not os.access(dest, os.R_OK):
|
if not os.access(dest, os.R_OK):
|
||||||
module.fail_json(msg="Destination %s not readable" % (dest))
|
module.fail_json(msg="Destination %s not readable" % (dest))
|
||||||
|
# Allow dest to be directory without compromising md5 check
|
||||||
|
if (os.path.isdir(dest)):
|
||||||
|
dest = os.join(dest, os.path.basename(src))
|
||||||
md5sum_dest = module.md5(dest)
|
md5sum_dest = module.md5(dest)
|
||||||
else:
|
else:
|
||||||
if not os.access(os.path.dirname(dest), os.W_OK):
|
if not os.access(os.path.dirname(dest), os.W_OK):
|
||||||
|
|
Loading…
Add table
Reference in a new issue