Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e36e955

Browse files
author
Scott Lee
committed
Cherry-pick hotfixes
1 parent 3e57e12 commit e36e955

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
@@ -2405,7 +2405,7 @@ def patch_cluster_custom_object_with_http_info(self, group, version, plural, nam
24052405

24062406
# HTTP header `Content-Type`
24072407
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2408-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2408+
['application/merge-patch+json']) # noqa: E501
24092409

24102410
# Authentication setting
24112411
auth_settings = ['BearerToken'] # noqa: E501
@@ -2574,7 +2574,7 @@ def patch_cluster_custom_object_scale_with_http_info(self, group, version, plura
25742574

25752575
# HTTP header `Content-Type`
25762576
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2577-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2577+
['application/merge-patch+json']) # noqa: E501
25782578

25792579
# Authentication setting
25802580
auth_settings = ['BearerToken'] # noqa: E501
@@ -2743,7 +2743,7 @@ def patch_cluster_custom_object_status_with_http_info(self, group, version, plur
27432743

27442744
# HTTP header `Content-Type`
27452745
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2746-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2746+
['application/merge-patch+json']) # noqa: E501
27472747

27482748
# Authentication setting
27492749
auth_settings = ['BearerToken'] # noqa: E501
@@ -2921,7 +2921,7 @@ def patch_namespaced_custom_object_with_http_info(self, group, version, namespac
29212921

29222922
# HTTP header `Content-Type`
29232923
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2924-
['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501
2924+
['application/merge-patch+json']) # noqa: E501
29252925

29262926
# Authentication setting
29272927
auth_settings = ['BearerToken'] # noqa: E501
@@ -3099,7 +3099,7 @@ def patch_namespaced_custom_object_scale_with_http_info(self, group, version, na
30993099

31003100
# HTTP header `Content-Type`
31013101
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
3102-
['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501
3102+
['application/merge-patch+json']) # noqa: E501
31033103

31043104
# Authentication setting
31053105
auth_settings = ['BearerToken'] # noqa: E501
@@ -3277,7 +3277,7 @@ def patch_namespaced_custom_object_status_with_http_info(self, group, version, n
32773277

32783278
# HTTP header `Content-Type`
32793279
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
3280-
['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501
3280+
['application/merge-patch+json']) # noqa: E501
32813281

32823282
# Authentication setting
32833283
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)