diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-06-19 08:59:19 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-06-19 09:01:08 -0700 |
commit | 4b29146c4d84a94c35e9f1bd763fcb85820e801c (patch) | |
tree | 42b4ebb3d307b63eca7455537e0a28fbcaf531cf /notification | |
parent | 8f31d843001c1832c5b468a7b26f315f046826d7 (diff) | |
download | ansible-modules-extras-4b29146c4d84a94c35e9f1bd763fcb85820e801c.tar.gz |
be explicit about urllib import and remove conditional urllib(2) import
urllib and urllib2 have been in the python stdlib since at least
python-2.3. There's no reason to conditionalize it.
Fixes https://github.com/ansible/ansible/issues/11322
Diffstat (limited to 'notification')
-rw-r--r-- | notification/flowdock.py | 5 | ||||
-rw-r--r-- | notification/grove.py | 2 | ||||
-rw-r--r-- | notification/hipchat.py | 5 | ||||
-rw-r--r-- | notification/nexmo.py | 1 | ||||
-rw-r--r-- | notification/sendgrid.py | 5 | ||||
-rw-r--r-- | notification/twilio.py | 5 |
6 files changed, 11 insertions, 12 deletions
diff --git a/notification/flowdock.py b/notification/flowdock.py index 7c42e586..34dad8db 100644 --- a/notification/flowdock.py +++ b/notification/flowdock.py @@ -85,8 +85,7 @@ options: choices: ['yes', 'no'] version_added: 1.5.1 -# informational: requirements for nodes -requirements: [ urllib, urllib2 ] +requirements: [ ] ''' EXAMPLES = ''' @@ -104,6 +103,8 @@ EXAMPLES = ''' tags=tag1,tag2,tag3 ''' +import urllib + # =========================================== # Module execution. # diff --git a/notification/grove.py b/notification/grove.py index 85601d1c..4e4a0b5b 100644 --- a/notification/grove.py +++ b/notification/grove.py @@ -49,6 +49,8 @@ EXAMPLES = ''' message=deployed {{ target }} ''' +import urllib + BASE_URL = 'https://grove.io/api/notice/%s/' # ============================================================== diff --git a/notification/hipchat.py b/notification/hipchat.py index 2498c118..32689965 100644 --- a/notification/hipchat.py +++ b/notification/hipchat.py @@ -62,8 +62,7 @@ options: version_added: 1.6.0 -# informational: requirements for nodes -requirements: [ urllib, urllib2 ] +requirements: [ ] author: "WAKAYAMA Shirou (@shirou), BOURDEL Paul (@pb8226)" ''' @@ -75,6 +74,8 @@ EXAMPLES = ''' # HipChat module specific support methods. # +import urllib + DEFAULT_URI = "https://api.hipchat.com/v1" MSG_URI_V1 = "/rooms/message" diff --git a/notification/nexmo.py b/notification/nexmo.py index d0c3d05e..89a246c0 100644 --- a/notification/nexmo.py +++ b/notification/nexmo.py @@ -71,6 +71,7 @@ EXAMPLES = """ msg: "{{ inventory_hostname }} completed" """ +import urllib NEXMO_API = 'https://rest.nexmo.com/sms/json' diff --git a/notification/sendgrid.py b/notification/sendgrid.py index 78806687..7a2ee3ad 100644 --- a/notification/sendgrid.py +++ b/notification/sendgrid.py @@ -84,10 +84,7 @@ EXAMPLES = ''' # ======================================= # sendgrid module support methods # -try: - import urllib, urllib2 -except ImportError: - module.fail_json(msg="urllib and urllib2 are required") +import urllib, urllib2 import base64 diff --git a/notification/twilio.py b/notification/twilio.py index e9ec5bcf..a2dd77fb 100644 --- a/notification/twilio.py +++ b/notification/twilio.py @@ -104,10 +104,7 @@ EXAMPLES = ''' # ======================================= # twilio module support methods # -try: - import urllib, urllib2 -except ImportError: - module.fail_json(msg="urllib and urllib2 are required") +import urllib, urllib2 import base64 |