-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fallback to merge patch if strategic merge patch is unavailable, as is the case for the custom objects API.
- Loading branch information
1 parent
84e4e28
commit b57fd8c
Showing
4 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
--- /tmp/api_client.py 2024-02-25 20:40:28.143350042 +0100 | ||
+++ kubernetes_asyncio/client/api_client.py 2024-02-25 20:40:32.954201652 +0100 | ||
@@ -535,10 +535,13 @@ | ||
--- /tmp/api_client.py 2024-12-18 03:36:59.552742383 +0000 | ||
+++ kubernetes_asyncio/client/api_client.py 2024-12-18 03:36:11.062928089 +0000 | ||
@@ -535,10 +535,17 @@ | ||
|
||
content_types = [x.lower() for x in content_types] | ||
|
||
- if (method == 'PATCH' and | ||
- 'application/json-patch+json' in content_types and | ||
- isinstance(body, list)): | ||
- return 'application/json-patch+json' | ||
+ if method == 'PATCH': | ||
+ if ('application/json-patch+json' in content_types and | ||
+ isinstance(body, list)): | ||
+ if 'application/json-patch+json' in content_types and | ||
+ isinstance(body, list): | ||
+ return 'application/json-patch+json' | ||
+ if ('application/strategic-merge-patch+json' in content_types and | ||
+ (isinstance(body, dict) or hasattr(body, "to_dict"))): | ||
+ return 'application/strategic-merge-patch+json' | ||
|
||
+ if isinstance(body, dict) or hasattr(body, "to_dict"): | ||
+ if 'application/strategic-merge-patch+json' in content_types: | ||
+ return 'application/strategic-merge-patch+json' | ||
+ elif 'application/merge-patch+json' in content_types: | ||
+ # Intended for cases where strategic merge patch is not | ||
+ # supported, like when patching custom objects. | ||
+ return 'application/merge-patch+json' | ||
|
||
if 'application/json' in content_types or '*/*' in content_types: | ||
return 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters