def demo_acl(): session = ZKSession("localhost:2181", timeout=10) print 'connected' acl = [{"perms":zookeeper.PERM_ALL, "scheme":"auth", "id":""}] session.add_auth("digest", "user:pass") session.create("/test-acl", "abc", acl, zookeeper.EPHEMERAL) print 'test-acl created' print "(acl,stat)=", session.get_acl("/test-acl")
def demo(): session = ZKSession("localhost:2181", timeout=10) print 'connected' session.create("/test-tmp", "abc", [ZOO_OPEN_ACL_UNSAFE], zookeeper.EPHEMERAL) print 'test-tmp created' print "(acl,stat)=", session.get_acl("/test-tmp") try: session.create("/test", "abc", [ZOO_OPEN_ACL_UNSAFE], 0) except zookeeper.NodeExistsException: pass print session.exists("/test") session.delete("/test") session.create("/test", "abc", [ZOO_OPEN_ACL_UNSAFE], 0) print session.get("/test") print 'done.' session.set("/test", "def") print session.get("/test")