mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-31 13:29:08 -07:00
Meraki modules - Added support for checking HTTP response codes (#42144)
* Added support for checking HTTP response codes - All request calls now check for response code before responding - If the response code isn't what it should be, it fails or returns nothing - Breaking this into multiple PRs to make backporting easier - Using status property in Meraki module utility which has the code * Change logic of HTTP checks so success is default
This commit is contained in:
parent
3ee3fc893d
commit
40b9862d38
5 changed files with 52 additions and 29 deletions
|
@ -218,8 +218,9 @@ def main():
|
|||
method='POST',
|
||||
payload=json.dumps(payload)
|
||||
)
|
||||
meraki.result['data'] = r
|
||||
meraki.result['changed'] = True
|
||||
if meraki.status == 201:
|
||||
meraki.result['data'] = r
|
||||
meraki.result['changed'] = True
|
||||
else:
|
||||
net = meraki.get_net(meraki.params['org_name'], meraki.params['net_name'], data=nets)
|
||||
proposed = payload
|
||||
|
@ -239,8 +240,9 @@ def main():
|
|||
r = meraki.request(path,
|
||||
method='PUT',
|
||||
payload=json.dumps(payload))
|
||||
meraki.result['data'] = r
|
||||
meraki.result['changed'] = True
|
||||
if meraki.status == 200:
|
||||
meraki.result['data'] = r
|
||||
meraki.result['changed'] = True
|
||||
elif meraki.params['state'] == 'absent':
|
||||
if is_net_valid(meraki, meraki.params['net_name'], nets) is True:
|
||||
net_id = meraki.get_net_id(net_name=meraki.params['net_name'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue