def tearDown(test): """The matching tearDown for setUp. The single argument is the test case passed to setUp. """ setupstack.tearDown(test) real_zk = testing_with_real_zookeeper() if real_zk: zk = zc.zk.ZooKeeper(real_zk) root = setupstack.globs(test)['/zc.zk.testing.test-root'] if zk.exists(root): zk.delete_recursive(root) zk.close()
def setup_tree(tree, connection_string, root='/test-root', zookeeper_node=False): zk = zc.zk.ZooKeeper(connection_string) if zk.exists(root): zk.delete_recursive(root) zk.create(root, '', zc.zk.OPEN_ACL_UNSAFE) zk.import_tree(tree or """ /fooservice /providers database = '/databases/foomain' threads = 1 favorite_color = 'red' """, root) if zookeeper_node: zk.import_tree(""" /zookeeper /quota """, root) zk.close()
import zc.zk zk = None try: host = '10.251.22.99:2181' zk = zc.zk.ZooKeeper(host) print zk zk.delete_recursive('brokers/topics/test') zk.close() except Exception as e: zk.close()
def delete_kafka_topics(): zk = zc.zk.ZooKeeper('telles-samza-master:2181') zk.delete_recursive('brokers/topics') zk.delete_recursive('config/topics')