From 2ecf3f9b94efcf6f4b2e7d293018fab57c6b3dcf Mon Sep 17 00:00:00 2001 From: Romeo Theriault Date: Fri, 15 Feb 2013 14:10:21 -1000 Subject: [PATCH] moved module checking below module initialization --- library/uri | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/uri b/library/uri index 56d32bd892..9c79df13b0 100644 --- a/library/uri +++ b/library/uri @@ -256,10 +256,6 @@ def uri(module, url, dest, user, password, body, method, headers, redirects): module.fail_json(msg="Socket error: %s to %s" % (e, url)) def main(): - if not HAS_HTTPLIB2: - module.fail_json(msg="httplib2 is not installed") - if not HAS_URLPARSE: - module.fail_json(msg="urlparse is not installed") module = AnsibleModule( argument_spec = dict( @@ -280,6 +276,11 @@ def main(): add_file_common_args=True ) + if not HAS_HTTPLIB2: + module.fail_json(msg="httplib2 is not installed") + if not HAS_URLPARSE: + module.fail_json(msg="urlparse is not installed") + url = module.params['url'] user = module.params['user'] password = module.params['password']