From 99746d4a8393bc3b0f4af71950837e30e73985a1 Mon Sep 17 00:00:00 2001 From: Ali Asad Lotia Date: Fri, 14 Sep 2012 08:02:30 +0100 Subject: [PATCH 1/2] 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. --- library/get_url | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/get_url b/library/get_url index f557b29ab91..cb848f8683a 100755 --- a/library/get_url +++ b/library/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) From c0aac03b0c3a15591e62a193dd466a83b62539ba Mon Sep 17 00:00:00 2001 From: Ali Asad Lotia Date: Fri, 14 Sep 2012 08:34:41 +0100 Subject: [PATCH 2/2] url_get module returns dest The url_get module now includes the destination in the returned JSON. --- library/get_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/get_url b/library/get_url index cb848f8683a..37a713d3226 100755 --- a/library/get_url +++ b/library/get_url @@ -148,7 +148,7 @@ def main(): 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) + module.exit_json(msg="file already exists", dest=dest, url=url, changed=False) # download to tmpsrc tmpsrc, info = url_get(module, url, dest)