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

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.
This commit is contained in:
MDCollins 2016-12-05 13:02:15 -08:00 committed by Matt Clay
parent 5bfbeadca3
commit 7d8d830aee

View file

@ -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: