From 9d705a42081f308b01132da1188a3a86a0c2c6fb Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 4 May 2016 01:27:17 -0400 Subject: [PATCH] Expect 204 status when using hipchat v2 api. When posting to the room notication api with hipchat v2 api, the expected return code is 204, as per: https://www.hipchat.com/docs/apiv2/method/send_room_notification fixes #2143 --- notification/hipchat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notification/hipchat.py b/notification/hipchat.py index f7543aa5592..8749b0b742e 100644 --- a/notification/hipchat.py +++ b/notification/hipchat.py @@ -155,7 +155,10 @@ def send_msg_v2(module, token, room, msg_from, msg, msg_format='text', module.exit_json(changed=False) response, info = fetch_url(module, url, data=data, headers=headers, method='POST') - if info['status'] == 200: + + # https://www.hipchat.com/docs/apiv2/method/send_room_notification shows + # 204 to be the expected result code. + if info['status'] in [200, 204]: return response.read() else: module.fail_json(msg="failed to send message, return status=%s" % str(info['status']))