mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Give nice error message if destination directory doesn't exist (issue #1048)
This commit is contained in:
parent
f8a9541405
commit
f52624f6d2
1 changed files with 2 additions and 0 deletions
|
@ -56,6 +56,8 @@ def main():
|
||||||
module.fail_json(msg="Destination %s cannot be a directory" % (dest))
|
module.fail_json(msg="Destination %s cannot be a directory" % (dest))
|
||||||
md5sum_dest = module.md5(dest)
|
md5sum_dest = module.md5(dest)
|
||||||
else:
|
else:
|
||||||
|
if not os.path.exists(os.path.dirname(dest)):
|
||||||
|
module.fail_json(msg="Destination directory %s does not exist" % (os.path.dirname(dest)))
|
||||||
if not os.access(os.path.dirname(dest), os.W_OK):
|
if not os.access(os.path.dirname(dest), os.W_OK):
|
||||||
module.fail_json(msg="Destination %s not writable" % (os.path.dirname(dest)))
|
module.fail_json(msg="Destination %s not writable" % (os.path.dirname(dest)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue