From 1a0a185ac364e7da6127fb661d29ef999ef5970c Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Tue, 2 Jun 2020 15:09:58 +0200 Subject: [PATCH] scaleway: Fix case mismatch causing key lookup failure (#445) The common http api client class used by the scaleway modules only enables automatic jsonification of the request body if the "Content-Type" header is application/json. The client only included "Content-type" in its default set of headers (notice the case variation). This caused a KeyError on send() if the caller relied on the default content-type value. --- changelogs/fragments/444-scaleway_fix_http_header_casing.yml | 2 ++ plugins/module_utils/scaleway.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/444-scaleway_fix_http_header_casing.yml diff --git a/changelogs/fragments/444-scaleway_fix_http_header_casing.yml b/changelogs/fragments/444-scaleway_fix_http_header_casing.yml new file mode 100644 index 0000000000..a261afbfb8 --- /dev/null +++ b/changelogs/fragments/444-scaleway_fix_http_header_casing.yml @@ -0,0 +1,2 @@ +bugfixes: + - scaleway - Fix bug causing KeyError exception on JSON http requests. (https://github.com/ansible-collections/community.general/pull/444) diff --git a/plugins/module_utils/scaleway.py b/plugins/module_utils/scaleway.py index 50041eff52..02e09394e6 100644 --- a/plugins/module_utils/scaleway.py +++ b/plugins/module_utils/scaleway.py @@ -90,7 +90,7 @@ class Scaleway(object): self.headers = { 'X-Auth-Token': self.module.params.get('api_token'), 'User-Agent': self.get_user_agent_string(module), - 'Content-type': 'application/json', + 'Content-Type': 'application/json', } self.name = None