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

From: Jayavardhan Katta <jkatta@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@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..c46aaf0 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=False): 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 not ignore_missing: + raise NotFoundError("WOKOBJST0001E", {'item': ident}) return json.loads(jsonstr) def get_object_version(self, obj_type, ident): -- 2.7.4

Reviewed-By: Lucio Correia <luciojhc@linux.vnet.ibm.com> On 31/01/2017 07:17, jkatta@linux.vnet.ibm.com wrote:
From: Jayavardhan Katta <jkatta@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@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..c46aaf0 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=False): 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 not ignore_missing: + raise NotFoundError("WOKOBJST0001E", {'item': ident}) return json.loads(jsonstr)
def get_object_version(self, obj_type, ident):
-- Lucio Correia
participants (3)
-
Aline Manera
-
jkatta@linux.vnet.ibm.com
-
Lucio Correia