From 7d8d830aee8b139f752f2d76cb80bbf624841b19 Mon Sep 17 00:00:00 2001 From: MDCollins Date: Mon, 5 Dec 2016 13:02:15 -0800 Subject: [PATCH] Update the status codes to look for (#2120) Creation of a maintenance window returns a 201 (PagerDuty Developer documentation is unfortunately incorrect). Deleting a maintenance window returns a 204. --- lib/ansible/modules/extras/monitoring/pagerduty.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/monitoring/pagerduty.py b/lib/ansible/modules/extras/monitoring/pagerduty.py index a6d6da7d72..e2ba95fef7 100644 --- a/lib/ansible/modules/extras/monitoring/pagerduty.py +++ b/lib/ansible/modules/extras/monitoring/pagerduty.py @@ -214,7 +214,7 @@ def create(module, name, user, passwd, token, requester_id, service, hours, minu data = json.dumps(request_data) response, info = fetch_url(module, url, data=data, headers=headers, method='POST') - if info['status'] != 200: + if info['status'] != 201: module.fail_json(msg="failed to create the window: %s" % info['msg']) try: @@ -240,7 +240,7 @@ def absent(module, name, user, passwd, token, requester_id, service): data = json.dumps(request_data) response, info = fetch_url(module, url, data=data, headers=headers, method='DELETE') - if info['status'] != 200: + if info['status'] != 204: module.fail_json(msg="failed to delete the window: %s" % info['msg']) try: