fix rest client patch and re-apply it

This commit is contained in:
Haowei Cai 2019-08-15 10:20:31 -07:00
parent 1712b52f14
commit 1b0efe4720
2 changed files with 5 additions and 1 deletions

View File

@ -155,6 +155,10 @@ class RESTClientObject(object):
if query_params:
url += '?' + urlencode(query_params)
if re.search('json', headers['Content-Type'], re.IGNORECASE):
if headers['Content-Type'] == 'application/json-patch+json':
if not isinstance(body, list):
headers['Content-Type'] = \
'application/strategic-merge-patch+json'
request_body = None
if body is not None:
request_body = json.dumps(body)

View File

@ -1,5 +1,5 @@
diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py
index 13b16c2f..41c53429 100644
index 0bb15d8..acf7b2b 100644
--- a/kubernetes/client/rest.py
+++ b/kubernetes/client/rest.py
@@ -155,6 +155,10 @@ class RESTClientObject(object):