mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudflare_dns: fix KeyError (#243)
Fix errors of the type KeyError: 'success' to show a more meaningful message Fixes: #236
This commit is contained in:
parent
8a45044ea7
commit
055c18c892
2 changed files with 6 additions and 0 deletions
2
changelogs/fragments/243-cloudflare_dns_fix_keyerror.yml
Normal file
2
changelogs/fragments/243-cloudflare_dns_fix_keyerror.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- cloudflare_dns - fix KeyError 'success' (https://github.com/ansible-collections/community.general/issues/236).
|
|
@ -496,6 +496,10 @@ class CloudflareAPI(object):
|
|||
if result is None:
|
||||
self.module.fail_json(msg=error_msg)
|
||||
|
||||
if 'success' not in result:
|
||||
error_msg += "; Unexpected error details: {0}".format(result.get('error'))
|
||||
self.module.fail_json(msg=error_msg)
|
||||
|
||||
if not result['success']:
|
||||
error_msg += "; Error details: "
|
||||
for error in result['errors']:
|
||||
|
|
Loading…
Reference in a new issue