Skip to content

Commit 04a4fb6

Browse files
committed
Updated rest client patch
I'm unsure about the function of this patch but I tried to keep the logic the same as the previous behavior. Just adjusting it so it applies to the new source
1 parent 1f95e8b commit 04a4fb6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

scripts/rest_client_patch.diff

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py
2-
index 5716565df..b788bf7d2 100644
2+
index 70c57e462..624d26115 100644
33
--- a/kubernetes/client/rest.py
44
+++ b/kubernetes/client/rest.py
5-
@@ -151,7 +151,12 @@ class RESTClientObject(object):
6-
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
7-
if query_params:
8-
url += '?' + urlencode(query_params)
9-
- if re.search('json', headers['Content-Type'], re.IGNORECASE):
10-
+ if (re.search('json', headers['Content-Type'], re.IGNORECASE) or
11-
+ headers['Content-Type'] == 'application/apply-patch+yaml'):
5+
@@ -159,7 +159,12 @@ class RESTClientObject:
6+
if (
7+
not content_type
8+
or re.search('json', content_type, re.IGNORECASE)
9+
+ or content_type == 'application/apply-patch+yaml'
10+
):
1211
+ if headers['Content-Type'] == 'application/json-patch+json':
1312
+ if not isinstance(body, list):
14-
+ headers['Content-Type'] = \
15-
+ 'application/strategic-merge-patch+json'
13+
+ headers['Content-Type'] = 'application/strategic-merge-patch+json'
14+
+ request_body = None
1615
request_body = None
1716
if body is not None:
1817
request_body = json.dumps(body)

0 commit comments

Comments
 (0)