From d5ab3dc0f38927f426f70c22e7143077c5b4e8cf Mon Sep 17 00:00:00 2001 From: Markus Ostertag Date: Tue, 26 Apr 2016 14:39:00 +0200 Subject: [PATCH] Change success status code to 202 As I already mentioned here: https://github.com/ansible/ansible-modules-extras/commit/a1b11826625b7f48d517b088651dc5ed4d6eb9d6#diff-d04a476e5d71372918cb6e7e5b39a683R120 @jimi-c added some "hidden" additional check in his urllib commit and broke the whole module for everybody as Datadog answers with an 202 in case of success (http://docs.datadoghq.com/api/#troubleshooting). --- monitoring/datadog_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitoring/datadog_event.py b/monitoring/datadog_event.py index 25e8ce052b6..5d083eab0f7 100644 --- a/monitoring/datadog_event.py +++ b/monitoring/datadog_event.py @@ -142,7 +142,7 @@ def post_event(module): headers = {"Content-Type": "application/json"} (response, info) = fetch_url(module, uri, data=json_body, headers=headers) - if info['status'] == 200: + if info['status'] == 202: response_body = response.read() response_json = module.from_json(response_body) if response_json['status'] == 'ok':