Skip to content

Commit d285cbb

Browse files
willthamesfabianvf
authored andcommitted
Allow content type specification in resource.patch (#174)
For Custom Resource Definitions, the strategic merge type will fail with "strategic merge patch format is not supported". Allow the override of content type when patching so that all three patch merge types are individually choosable - this means that JSON Merge Patch operations can be chosen for certain operations
1 parent 295cc93 commit d285cbb

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

openshift/dynamic/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ def patch(self, resource, body=None, name=None, namespace=None, **kwargs):
185185
if resource.namespaced:
186186
namespace = self.ensure_namespace(resource, namespace, body)
187187

188+
content_type = kwargs.pop('content_type', 'application/strategic-merge-patch+json')
188189
path = resource.path(name=name, namespace=namespace, **kwargs)
189190

190-
content_type = self.client.\
191-
select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])
192-
193191
return self.request('patch', path, body=body, content_type=content_type)
194192

195193

0 commit comments

Comments
 (0)