From 79173ac18de66bcdb6c25729fb4561c772d37cab 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 --- clustering/consul.py | 6 +++--- clustering/consul_acl.py | 4 ++-- clustering/consul_kv.py | 4 ++-- clustering/consul_session.py | 4 ++-- database/misc/riak.py | 5 ++--- monitoring/bigpanda.py | 6 +++--- monitoring/boundary_meter.py | 4 ++-- monitoring/datadog_event.py | 6 +++--- network/a10/a10_virtual_server.py | 8 +++----- 9 files changed, 22 insertions(+), 25 deletions(-) diff --git a/clustering/consul.py b/clustering/consul.py index 116517571a5..f72fc6ddcac 100644 --- a/clustering/consul.py +++ b/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/clustering/consul_acl.py b/clustering/consul_acl.py index 250de24e2a3..c133704b64d 100644 --- a/clustering/consul_acl.py +++ b/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/clustering/consul_kv.py b/clustering/consul_kv.py index b0d07dda83a..06dd55b71fc 100644 --- a/clustering/consul_kv.py +++ b/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/clustering/consul_session.py b/clustering/consul_session.py index ef4646c35e4..c298ea7fa57 100644 --- a/clustering/consul_session.py +++ b/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/database/misc/riak.py b/database/misc/riak.py index 12586651887..453e6c15f3e 100644 --- a/database/misc/riak.py +++ b/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/monitoring/bigpanda.py b/monitoring/bigpanda.py index 3bed44893b7..cd08ac9f29e 100644 --- a/monitoring/bigpanda.py +++ b/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/monitoring/boundary_meter.py b/monitoring/boundary_meter.py index 431a6ace1b9..3e03a55c8aa 100644 --- a/monitoring/boundary_meter.py +++ b/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/monitoring/datadog_event.py b/monitoring/datadog_event.py index ebbad039dec..406a5ea1865 100644 --- a/monitoring/datadog_event.py +++ b/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/network/a10/a10_virtual_server.py b/network/a10/a10_virtual_server.py index eb308a3032a..2dbaa9121eb 100644 --- a/network/a10/a10_virtual_server.py +++ b/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()