diff --git a/changelogs/fragments/66957-scaleway-jsonify-only-for-json-requests.yml b/changelogs/fragments/66957-scaleway-jsonify-only-for-json-requests.yml new file mode 100644 index 00000000000..99d0306e0bb --- /dev/null +++ b/changelogs/fragments/66957-scaleway-jsonify-only-for-json-requests.yml @@ -0,0 +1,2 @@ +bugfixes: +- 'scaleway: use jsonify unmarshaller only for application/json requests to avoid breaking the multiline configuration with requests in text/plain (https://github.com/ansible/ansible/issues/65036)' diff --git a/lib/ansible/module_utils/scaleway.py b/lib/ansible/module_utils/scaleway.py index d8202976f2c..50041eff529 100644 --- a/lib/ansible/module_utils/scaleway.py +++ b/lib/ansible/module_utils/scaleway.py @@ -118,11 +118,13 @@ class Scaleway(object): def send(self, method, path, data=None, headers=None, params=None): url = self._url_builder(path=path, params=params) self.warn(url) - data = self.module.jsonify(data) if headers is not None: self.headers.update(headers) + if self.headers['Content-Type'] == "application/json": + data = self.module.jsonify(data) + resp, info = fetch_url( self.module, url, data=data, headers=self.headers, method=method, timeout=self.module.params.get('api_timeout')