diff --git a/changelogs/fragments/511-cloudflare_dns-verbose-failure.yml b/changelogs/fragments/511-cloudflare_dns-verbose-failure.yml new file mode 100644 index 0000000000..5c7908a78f --- /dev/null +++ b/changelogs/fragments/511-cloudflare_dns-verbose-failure.yml @@ -0,0 +1,2 @@ +minor_changes: + - cloudflare_dns - Report unexpected failure with more detail (https://github.com/ansible-collections/community.general/pull/511). diff --git a/plugins/modules/net_tools/cloudflare_dns.py b/plugins/modules/net_tools/cloudflare_dns.py index 48901cab83..7634557129 100644 --- a/plugins/modules/net_tools/cloudflare_dns.py +++ b/plugins/modules/net_tools/cloudflare_dns.py @@ -452,7 +452,7 @@ class CloudflareAPI(object): timeout=self.timeout) if info['status'] not in [200, 304, 400, 401, 403, 429, 405, 415]: - self.module.fail_json(msg="Failed API call {0}; got unexpected HTTP code {1}".format(api_call, info['status'])) + self.module.fail_json(msg="Failed API call {0}; got unexpected HTTP code {1}: {2}".format(api_call, info['status'], info.get('msg'))) error_msg = '' if info['status'] == 401: