Skip to content

Commit d999be1

Browse files
committed
Apply hotfixes
Signed-off-by: Nabarun Pal <[email protected]>
1 parent b4cfe46 commit d999be1

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

kubernetes/client/api/custom_objects_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@ def patch_cluster_custom_object_with_http_info(self, group, version, plural, nam
24252425

24262426
# HTTP header `Content-Type`
24272427
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2428-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2428+
['application/merge-patch+json']) # noqa: E501
24292429

24302430
# Authentication setting
24312431
auth_settings = ['BearerToken'] # noqa: E501
@@ -2594,7 +2594,7 @@ def patch_cluster_custom_object_scale_with_http_info(self, group, version, plura
25942594

25952595
# HTTP header `Content-Type`
25962596
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2597-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2597+
['application/merge-patch+json']) # noqa: E501
25982598

25992599
# Authentication setting
26002600
auth_settings = ['BearerToken'] # noqa: E501
@@ -2763,7 +2763,7 @@ def patch_cluster_custom_object_status_with_http_info(self, group, version, plur
27632763

27642764
# HTTP header `Content-Type`
27652765
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2766-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2766+
['application/merge-patch+json']) # noqa: E501
27672767

27682768
# Authentication setting
27692769
auth_settings = ['BearerToken'] # noqa: E501
@@ -2941,7 +2941,7 @@ def patch_namespaced_custom_object_with_http_info(self, group, version, namespac
29412941

29422942
# HTTP header `Content-Type`
29432943
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2944-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2944+
['application/merge-patch+json']) # noqa: E501
29452945

29462946
# Authentication setting
29472947
auth_settings = ['BearerToken'] # noqa: E501
@@ -3119,7 +3119,7 @@ def patch_namespaced_custom_object_scale_with_http_info(self, group, version, na
31193119

31203120
# HTTP header `Content-Type`
31213121
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
3122-
['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501
3122+
['application/merge-patch+json']) # noqa: E501
31233123

31243124
# Authentication setting
31253125
auth_settings = ['BearerToken'] # noqa: E501
@@ -3297,7 +3297,7 @@ def patch_namespaced_custom_object_status_with_http_info(self, group, version, n
32973297

32983298
# HTTP header `Content-Type`
32993299
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
3300-
['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501
3300+
['application/merge-patch+json']) # noqa: E501
33013301

33023302
# Authentication setting
33033303
auth_settings = ['BearerToken'] # noqa: E501

kubernetes/client/apis/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from __future__ import absolute_import
2+
import warnings
3+
4+
# flake8: noqa
5+
6+
# alias kubernetes.client.api package and print deprecation warning
7+
from kubernetes.client.api import *
8+
9+
warnings.filterwarnings('default', module='kubernetes.client.apis')
10+
warnings.warn(
11+
"The package kubernetes.client.apis is renamed and deprecated, use kubernetes.client.api instead (please note that the trailing s was removed).",
12+
DeprecationWarning
13+
)

kubernetes/test/test_api_client.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# coding: utf-8
2+
3+
4+
import atexit
5+
import weakref
6+
import unittest
7+
8+
import kubernetes
9+
10+
11+
class TestApiClient(unittest.TestCase):
12+
13+
def test_context_manager_closes_threadpool(self):
14+
with kubernetes.client.ApiClient() as client:
15+
self.assertIsNotNone(client.pool)
16+
pool_ref = weakref.ref(client._pool)
17+
self.assertIsNotNone(pool_ref())
18+
self.assertIsNone(pool_ref())
19+
20+
def test_atexit_closes_threadpool(self):
21+
client = kubernetes.client.ApiClient()
22+
self.assertIsNotNone(client.pool)
23+
self.assertIsNotNone(client._pool)
24+
atexit._run_exitfuncs()
25+
self.assertIsNone(client._pool)

0 commit comments

Comments
 (0)