Verify if key exists before reading
This commit is contained in:
parent
d2f93b3a2e
commit
3bad3de720
|
@ -208,8 +208,13 @@ class ZKHandler(object):
|
||||||
"""
|
"""
|
||||||
Read data from a key
|
Read data from a key
|
||||||
"""
|
"""
|
||||||
path = self.get_schema_path(key)
|
if self.exists(key):
|
||||||
return self.zk_conn.get(path)[0].decode(self.encoding)
|
path = self.get_schema_path(key)
|
||||||
|
data = self.zk_conn.get(path)[0].decode(self.encoding)
|
||||||
|
else:
|
||||||
|
data = None
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
def write(self, kvpairs):
|
def write(self, kvpairs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue