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:
parent
5bfbeadca3
commit
7d8d830aee
1 changed files with 2 additions and 2 deletions
|
@ -214,7 +214,7 @@ def create(module, name, user, passwd, token, requester_id, service, hours, minu
|
||||||
|
|
||||||
data = json.dumps(request_data)
|
data = json.dumps(request_data)
|
||||||
response, info = fetch_url(module, url, data=data, headers=headers, method='POST')
|
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'])
|
module.fail_json(msg="failed to create the window: %s" % info['msg'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -240,7 +240,7 @@ def absent(module, name, user, passwd, token, requester_id, service):
|
||||||
|
|
||||||
data = json.dumps(request_data)
|
data = json.dumps(request_data)
|
||||||
response, info = fetch_url(module, url, data=data, headers=headers, method='DELETE')
|
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'])
|
module.fail_json(msg="failed to delete the window: %s" % info['msg'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue