From 8dbe4572ebc286c3ecf60ece457e2db45347b0d4 Mon Sep 17 00:00:00 2001 From: Nicholas Hansen Date: Tue, 23 Apr 2024 10:09:31 +0100 Subject: [PATCH 1/2] Fix: handle unset response_types_map argument --- kubernetes_asyncio/client/api_client.py | 4 +++- scripts/update-client.sh | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py index 0d543478..2791a9cd 100644 --- a/kubernetes_asyncio/client/api_client.py +++ b/kubernetes_asyncio/client/api_client.py @@ -198,7 +198,9 @@ async def __call_api( if not _preload_content: return return_data - response_type = response_types_map.get(response_data.status, None) + response_type = None + if response_types_map: + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None diff --git a/scripts/update-client.sh b/scripts/update-client.sh index 98526506..a60b5d65 100755 --- a/scripts/update-client.sh +++ b/scripts/update-client.sh @@ -66,6 +66,8 @@ sed -i'' "s,^DEVELOPMENT_STATUS = .*,DEVELOPMENT_STATUS = \\\"${DEVELOPMENT_STAT echo ">>> fix generated api client for patching with strategic merge..." patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_strategic_merge_patch.diff" +echo ">>> fix generated api client by adding 'none' check..." +patch "${CLIENT_ROOT}/client/api_client.py" "${SCRIPT_ROOT}/api_client_response_types_map.diff" echo ">>> fix generated rest client by increasing aiohttp read buffer to 2MiB..." patch "${CLIENT_ROOT}/client/rest.py" "${SCRIPT_ROOT}/rest_client_patch_read_bufsize.diff" echo ">>> fix generated rest client and configuration to support customer server hostname TLS verification..." From 7d5a54914412ba6f4d09d087919e3102c7368112 Mon Sep 17 00:00:00 2001 From: Nicholas Hansen Date: Tue, 23 Apr 2024 10:15:39 +0100 Subject: [PATCH 2/2] Add untracked file --- scripts/api_client_response_types_map_patch.diff | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/api_client_response_types_map_patch.diff diff --git a/scripts/api_client_response_types_map_patch.diff b/scripts/api_client_response_types_map_patch.diff new file mode 100644 index 00000000..71f939d5 --- /dev/null +++ b/scripts/api_client_response_types_map_patch.diff @@ -0,0 +1,15 @@ +diff --git a/kubernetes_asyncio/client/api_client.py b/kubernetes_asyncio/client/api_client.py +index 0d543478..2791a9cd 100644 +--- a/kubernetes_asyncio/client/api_client.py ++++ b/kubernetes_asyncio/client/api_client.py +@@ -198,7 +198,9 @@ class ApiClient(object): + if not _preload_content: + return return_data + +- response_type = response_types_map.get(response_data.status, None) ++ response_type = None ++ if response_types_map: ++ response_type = response_types_map.get(response_data.status, None) + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None