mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00: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:
committed by
GitHub
parent
8a45044ea7
commit
055c18c892
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']:
|
||||
|
||||
Reference in New Issue
Block a user