Indicate thirsty argument required if dest is dir.
The check for the destination being a directory is now done before checking if the file exists, that way the user is informed that the thirsty argument is required.
This commit is contained in:
parent
9b3ad14aee
commit
6867d9730e
1 changed files with 2 additions and 3 deletions
5
get_url
5
get_url
|
@ -145,11 +145,10 @@ def main():
|
|||
thirsty = module.boolean(module.params['thirsty'])
|
||||
|
||||
if not thirsty:
|
||||
if os.path.exists(dest):
|
||||
module.exit_json(msg="file already exists", changed=False)
|
||||
if os.path.isdir(dest):
|
||||
module.fail_json(msg="non-thirsty mode needs a filename for a destination, not a directory")
|
||||
|
||||
if os.path.exists(dest):
|
||||
module.exit_json(msg="file already exists", changed=False)
|
||||
|
||||
# download to tmpsrc
|
||||
tmpsrc, info = url_get(module, url, dest)
|
||||
|
|
Loading…
Reference in a new issue