From ca91ac2ca09821b64d2d93a3d6c56e975133a2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 27 Feb 2019 10:22:20 +0100 Subject: [PATCH] cloudscale: improve error handling (#53054) --- lib/ansible/module_utils/cloudscale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/cloudscale.py b/lib/ansible/module_utils/cloudscale.py index 46e0532d4e..c5634a3886 100644 --- a/lib/ansible/module_utils/cloudscale.py +++ b/lib/ansible/module_utils/cloudscale.py @@ -34,7 +34,7 @@ class AnsibleCloudscaleBase(object): timeout=self._module.params['api_timeout']) if info['status'] == 200: - return self._module.from_json(to_text(resp.read())) + return self._module.from_json(to_text(resp.read(), errors='surrogate_or_strict')) elif info['status'] == 404: return None else: @@ -55,7 +55,7 @@ class AnsibleCloudscaleBase(object): timeout=self._module.params['api_timeout']) if info['status'] in (200, 201): - return self._module.from_json(to_text(resp.read())) + return self._module.from_json(to_text(resp.read(), errors='surrogate_or_strict')) elif info['status'] == 204: return None else: