From a4859e1087118f9804cf0a55b3b44e6a72761ccb Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 20 Jul 2015 23:02:44 -0700 Subject: [PATCH] Clean up unneeded urllib2 imports --- lib/ansible/modules/extras/clustering/consul.py | 6 +++--- lib/ansible/modules/extras/clustering/consul_acl.py | 4 ++-- lib/ansible/modules/extras/clustering/consul_kv.py | 4 ++-- lib/ansible/modules/extras/clustering/consul_session.py | 4 ++-- lib/ansible/modules/extras/database/misc/riak.py | 5 ++--- lib/ansible/modules/extras/monitoring/bigpanda.py | 6 +++--- lib/ansible/modules/extras/monitoring/boundary_meter.py | 4 ++-- lib/ansible/modules/extras/monitoring/datadog_event.py | 6 +++--- .../modules/extras/network/a10/a10_virtual_server.py | 8 +++----- 9 files changed, 22 insertions(+), 25 deletions(-) diff --git a/lib/ansible/modules/extras/clustering/consul.py b/lib/ansible/modules/extras/clustering/consul.py index 116517571a..f72fc6ddca 100644 --- a/lib/ansible/modules/extras/clustering/consul.py +++ b/lib/ansible/modules/extras/clustering/consul.py @@ -166,7 +166,6 @@ EXAMPLES = ''' ''' import sys -import urllib2 try: import json @@ -179,7 +178,7 @@ try: python_consul_installed = True except ImportError, e: python_consul_installed = False - + def register_with_consul(module): state = module.params.get('state') @@ -503,4 +502,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/clustering/consul_acl.py b/lib/ansible/modules/extras/clustering/consul_acl.py index 250de24e2a..c133704b64 100644 --- a/lib/ansible/modules/extras/clustering/consul_acl.py +++ b/lib/ansible/modules/extras/clustering/consul_acl.py @@ -92,7 +92,6 @@ EXAMPLES = ''' ''' import sys -import urllib2 try: import consul @@ -318,4 +317,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/clustering/consul_kv.py b/lib/ansible/modules/extras/clustering/consul_kv.py index b0d07dda83..06dd55b71f 100644 --- a/lib/ansible/modules/extras/clustering/consul_kv.py +++ b/lib/ansible/modules/extras/clustering/consul_kv.py @@ -121,7 +121,6 @@ EXAMPLES = ''' ''' import sys -import urllib2 try: import json @@ -261,4 +260,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/clustering/consul_session.py b/lib/ansible/modules/extras/clustering/consul_session.py index ef4646c35e..c298ea7fa5 100644 --- a/lib/ansible/modules/extras/clustering/consul_session.py +++ b/lib/ansible/modules/extras/clustering/consul_session.py @@ -114,7 +114,6 @@ EXAMPLES = ''' ''' import sys -import urllib2 try: import consul @@ -266,4 +265,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/database/misc/riak.py b/lib/ansible/modules/extras/database/misc/riak.py index 1258665188..453e6c15f3 100644 --- a/lib/ansible/modules/extras/database/misc/riak.py +++ b/lib/ansible/modules/extras/database/misc/riak.py @@ -97,7 +97,6 @@ EXAMPLES = ''' - riak: wait_for_service=kv ''' -import urllib2 import time import socket import sys @@ -254,5 +253,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * - -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/bigpanda.py b/lib/ansible/modules/extras/monitoring/bigpanda.py index b1a45145ed..1ab0e57cd1 100644 --- a/lib/ansible/modules/extras/monitoring/bigpanda.py +++ b/lib/ansible/modules/extras/monitoring/bigpanda.py @@ -59,7 +59,7 @@ options: choices: ['yes', 'no'] # informational: requirements for nodes -requirements: [ urllib, urllib2 ] +requirements: [ ] ''' EXAMPLES = ''' @@ -168,5 +168,5 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * - -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/boundary_meter.py b/lib/ansible/modules/extras/monitoring/boundary_meter.py index 431a6ace1b..3e03a55c8a 100644 --- a/lib/ansible/modules/extras/monitoring/boundary_meter.py +++ b/lib/ansible/modules/extras/monitoring/boundary_meter.py @@ -38,7 +38,6 @@ author: "curtis (@ccollicutt)" requirements: - Boundary API access - bprobe is required to send data, but not to register a meter - - Python urllib2 options: name: description: @@ -252,5 +251,6 @@ def main(): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/monitoring/datadog_event.py b/lib/ansible/modules/extras/monitoring/datadog_event.py index ebbad039de..406a5ea186 100644 --- a/lib/ansible/modules/extras/monitoring/datadog_event.py +++ b/lib/ansible/modules/extras/monitoring/datadog_event.py @@ -16,7 +16,7 @@ description: version_added: "1.3" author: "Artūras `arturaz` Šlajus (@arturaz)" notes: [] -requirements: [urllib2] +requirements: [] options: api_key: description: ["Your DataDog API key."] @@ -139,5 +139,5 @@ def post_event(module): # import module snippets from ansible.module_utils.basic import * from ansible.module_utils.urls import * - -main() +if __name__ == '__main__': + main() diff --git a/lib/ansible/modules/extras/network/a10/a10_virtual_server.py b/lib/ansible/modules/extras/network/a10/a10_virtual_server.py index eb308a3032..2dbaa9121e 100644 --- a/lib/ansible/modules/extras/network/a10/a10_virtual_server.py +++ b/lib/ansible/modules/extras/network/a10/a10_virtual_server.py @@ -31,9 +31,7 @@ description: author: "Mischa Peters (@mischapeters)" notes: - Requires A10 Networks aXAPI 2.1 -requirements: - - urllib2 - - re +requirements: [] options: host: description: @@ -294,6 +292,6 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.urls import * from ansible.module_utils.a10 import * - -main() +if __name__ == '__main__': + main()