Skip to content

Commit 9e3641d

Browse files
committed
apply hotfixes
1 parent 286bd61 commit 9e3641d

File tree

5 files changed

+83
-9
lines changed

5 files changed

+83
-9
lines changed

kubernetes/client/api/custom_objects_api.py

+6-6
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

+13
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/client/models/v1_projected_volume_source.py

-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ def sources(self, sources):
9999
:param sources: The sources of this V1ProjectedVolumeSource. # noqa: E501
100100
:type: list[V1VolumeProjection]
101101
"""
102-
if self.local_vars_configuration.client_side_validation and sources is None: # noqa: E501
103-
raise ValueError("Invalid value for `sources`, must not be `None`") # noqa: E501
104-
105102
self._sources = sources
106103

107104
def to_dict(self):

kubernetes/test/test_api_client.py

+25
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)

kubernetes/test/test_configuration.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# coding: utf-8
2+
3+
import unittest
4+
5+
from kubernetes.client import Configuration
6+
7+
class TestConfiguration(unittest.TestCase):
8+
9+
def setUp(self):
10+
pass
11+
12+
def tearDown(self):
13+
# reset Configuration
14+
Configuration.set_default(None)
15+
16+
def testConfiguration(self):
17+
# check that different instances use different dictionaries
18+
c1 = Configuration()
19+
c2 = Configuration()
20+
self.assertNotEqual(id(c1.api_key), id(c2.api_key))
21+
self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix))
22+
23+
def testDefaultConfiguration(self):
24+
# prepare default configuration
25+
c1 = Configuration(host="example.com")
26+
c1.debug = True
27+
Configuration.set_default(c1)
28+
29+
# get default configuration
30+
c2 = Configuration.get_default_copy()
31+
self.assertEqual(c2.host, "example.com")
32+
self.assertTrue(c2.debug)
33+
34+
self.assertNotEqual(id(c1.api_key), id(c2.api_key))
35+
self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix))
36+
37+
38+
if __name__ == '__main__':
39+
unittest.main()

0 commit comments

Comments
 (0)