1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Typo fixes, tighter error handling, corrected check mode support

This commit is contained in:
Adam Garside 2013-05-15 10:37:45 -04:00
parent d29d142a2d
commit 628254a8ed

View file

@ -78,7 +78,7 @@ def main():
"tada", "tmyk", "trombone", "vuvuzela", "tada", "tmyk", "trombone", "vuvuzela",
"yeah", "yodel"]), "yeah", "yodel"]),
), ),
supports_check_mode=True supports_check_mode=False
) )
subscription = module.params["subscription"] subscription = module.params["subscription"]
@ -117,8 +117,14 @@ def main():
req.add_header('User-agent', AGENT) req.add_header('User-agent', AGENT)
response = opener.open(req) response = opener.open(req)
except urllib2.HTTPError, e:
if not (200 <= e.code < 300):
module.fail_json(msg="unable to send msg: '%s', campfire api"
" returned error code: '%s'" %
(msg, e.code))
except Exception, e: except Exception, e:
module.fail_json(msg="unable to sent msg: %s" % e) module.fail_json(msg="unable to send msg: %s" % msg)
module.exit_json(changed=True, room=room, msg=msg, notify=notify) module.exit_json(changed=True, room=room, msg=msg, notify=notify)