Commit 2ecf3f9b by Romeo Theriault Committed by Michael DeHaan

moved module checking below module initialization

parent 27145fab
...@@ -256,10 +256,6 @@ def uri(module, url, dest, user, password, body, method, headers, redirects): ...@@ -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)) module.fail_json(msg="Socket error: %s to %s" % (e, url))
def main(): 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( module = AnsibleModule(
argument_spec = dict( argument_spec = dict(
...@@ -280,6 +276,11 @@ def main(): ...@@ -280,6 +276,11 @@ def main():
add_file_common_args=True 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'] url = module.params['url']
user = module.params['user'] user = module.params['user']
password = module.params['password'] password = module.params['password']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment