[Kimchi-devel] [PATCH] [Wok] Fix to the WoK for the Kimchi issue #1102

jkatta at linux.vnet.ibm.com jkatta at linux.vnet.ibm.com
Mon Jan 30 10:16:05 UTC 2017


From: Jayavardhan Katta <jkatta at linux.vnet.ibm.com>

As a fix to the Kimchi issue #1102, some fix needs to be given for the WoK framework as well.

Signed-off-by: Jayavardhan Katta <jkatta at linux.vnet.ibm.com>
---
 src/wok/objectstore.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/wok/objectstore.py b/src/wok/objectstore.py
index a571e5f..eb49056 100644
--- a/src/wok/objectstore.py
+++ b/src/wok/objectstore.py
@@ -52,7 +52,7 @@ class ObjectStoreSession(object):
         objects.sort(key=lambda (_, obj): obj[sort_key])
         return [ident for ident, _ in objects]
 
-    def get(self, obj_type, ident):
+    def get(self, obj_type, ident, ignore_missing=True):
         c = self.conn.cursor()
         res = c.execute('SELECT json FROM objects WHERE type=? AND id=?',
                         (obj_type, ident))
@@ -60,7 +60,10 @@ class ObjectStoreSession(object):
             jsonstr = res.fetchall()[0][0]
         except IndexError:
             self.conn.rollback()
-            raise NotFoundError("WOKOBJST0001E", {'item': ident})
+            data = {"":""}
+            jsonstr = json.dumps(data)
+            if ignore_missing:
+	         raise NotFoundError("WOKOBJST0001E", {'item': ident})
         return json.loads(jsonstr)
 
     def get_object_version(self, obj_type, ident):
-- 
2.7.4



More information about the Kimchi-devel mailing list