python-etcd
python-etcd copied to clipboard
EtcdResult if the current result is a leaf should return none not self
In my opinion, if the node(dir) has no child or leave, then the children or leaves attribute should be None
+1
+1 But that change would certainly break my code that uses this library.
@lechat that's exactly why I didn't merge this. I am thinking of making this behaviour activable with a flag, still I have no time to work on this for the next week at least.
+1 by the way could you add a list dir function to Client?
I'm using following code,now.
def list_etcd_dir(client, path):
if not is_alive(etcd_client):
logger.error("can't connected to etcd server")
try:
result = client.read(path)
if not result.dir:
logger.error("not a dir")
return []
else:
if result.children.next() != result:
f = lambda x:x.split('/')[-1]
return [f(i.key) for i in result.children]
else:
return []
except:
logger.error(error)
return []