diff --git a/changelogs/fragments/9818-cloudflare-dns-exhausted-response.yml b/changelogs/fragments/9818-cloudflare-dns-exhausted-response.yml new file mode 100644 index 0000000000..a60f3145b4 --- /dev/null +++ b/changelogs/fragments/9818-cloudflare-dns-exhausted-response.yml @@ -0,0 +1,2 @@ +bugfixes: + - cloudlare_dns - handle exhausted response stream in case of HTTP errors to show nice error message to the user (https://github.com/ansible-collections/community.general/issues/9782, https://github.com/ansible-collections/community.general/pull/9818). diff --git a/plugins/modules/cloudflare_dns.py b/plugins/modules/cloudflare_dns.py index a51337e328..e1b75e30ca 100644 --- a/plugins/modules/cloudflare_dns.py +++ b/plugins/modules/cloudflare_dns.py @@ -551,6 +551,9 @@ class CloudflareAPI(object): try: content = resp.read() except AttributeError: + content = None + + if not content: if info['body']: content = info['body'] else: