integ/python/python-kubernetes/centos/patches/0006-Fixed-Watch.unmarshal_...

29 lines
911 B
Diff

From f11587d0e3cedf645ba12fe4dfd7971ee7162c9d Mon Sep 17 00:00:00 2001
From: Alexey Volkov <alexey.volkov@ark-kun.com>
Date: Thu, 17 Oct 2019 17:40:20 -0700
Subject: [PATCH 06/13] Fixed Watch.unmarshal_event when data is not a
JSON-serialized object
Fixes https://github.com/kubernetes-client/python/issues/982
Fixes https://github.com/kubernetes-client/python/issues/983
---
watch/watch.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/watch/watch.py b/watch/watch.py
index 77b9794..ba87de9 100644
--- a/watch/watch.py
+++ b/watch/watch.py
@@ -88,6 +88,8 @@ class Watch(object):
js = json.loads(data)
except ValueError:
return data
+ if not (isinstance(js, dict) and 'object' in js):
+ return data
js['raw_object'] = js['object']
if return_type:
obj = SimpleNamespace(data=json.dumps(js['raw_object']))
--
2.25.1