Add check_mode support to HipChat module

The HipChat module declares to support check_mode,
but the message is sent in any case.

With this, if executed in check mode, the module will exit
before actually sending the message to HipChat.

It will return changed=False, as per the convention
for notifications modules.
reviewable/pr18780/r1
Jean-Fred Berthelot 11 years ago committed by Jean-Fred
parent 19b345932a
commit f0508fa30e

@ -96,6 +96,11 @@ def send_msg(module, token, room, msg_from, msg, msg_format='text',
url = api + "?auth_token=%s" % (token)
data = urllib.urlencode(params)
if module.check_mode:
# In check mode, exit before actually sending the message
module.exit_json(changed=False)
response, info = fetch_url(module, url, data=data)
if info['status'] == 200:
return response.read()

Loading…
Cancel
Save