diff options
author | Julien Danjou <julien@danjou.info> | 2014-12-09 17:50:46 +0100 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2014-12-09 17:50:46 +0100 |
commit | 41dab3597561e31ddd50ef358317ff171de62529 (patch) | |
tree | 23574ca39f971b7fc799098fbfde6faf37ecf7db | |
parent | 1cb825dd5f9d1bf059ca09e396b5d018a90c8d5c (diff) | |
download | tooz-41dab3597561e31ddd50ef358317ff171de62529.tar.gz |
zookeeper: add support for delete group
Change-Id: I21dd62c93dd3d3394c549245b1d8d2633979927d
-rw-r--r-- | tooz/drivers/zookeeper.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tooz/drivers/zookeeper.py b/tooz/drivers/zookeeper.py index a48cfda..bd97ab6 100644 --- a/tooz/drivers/zookeeper.py +++ b/tooz/drivers/zookeeper.py @@ -94,6 +94,27 @@ class BaseZooKeeperDriver(coordination.CoordinationDriver): group_id=group_id) @staticmethod + def _delete_group_handler(async_result, timeout, + timeout_exception, group_id): + try: + async_result.get(block=True, timeout=timeout) + except timeout_exception as e: + raise coordination.OperationTimedOut(utils.exception_message(e)) + except exceptions.NoNodeError: + raise coordination.GroupNotCreated(group_id) + except exceptions.NotEmptyError: + raise coordination.GroupNotEmpty(group_id) + except exceptions.ZookeeperError as e: + raise coordination.ToozError(utils.exception_message(e)) + + def delete_group(self, group_id): + group_path = self._path_group(group_id) + async_result = self._coord.delete_async(group_path) + return ZooAsyncResult(async_result, self._delete_group_handler, + timeout_exception=self._timeout_exception, + group_id=group_id) + + @staticmethod def _join_group_handler(async_result, timeout, timeout_exception, group_id, member_id): try: |