Add support for recursive znode deletion
This commit is contained in:
parent
9aac5784d3
commit
b8bc7ed9ff
1 changed files with 9 additions and 2 deletions
|
@ -50,6 +50,12 @@ options:
|
||||||
- The amount of time to wait for a node to appear.
|
- The amount of time to wait for a node to appear.
|
||||||
default: 300
|
default: 300
|
||||||
required: false
|
required: false
|
||||||
|
recursive:
|
||||||
|
description:
|
||||||
|
- Recursively delete node and all its children.
|
||||||
|
default: False
|
||||||
|
required: false
|
||||||
|
version_added: "2.1"
|
||||||
requirements:
|
requirements:
|
||||||
- kazoo >= 2.1
|
- kazoo >= 2.1
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
|
@ -90,7 +96,8 @@ def main():
|
||||||
value=dict(required=False, default=None, type='str'),
|
value=dict(required=False, default=None, type='str'),
|
||||||
op=dict(required=False, default=None, choices=['get', 'wait', 'list']),
|
op=dict(required=False, default=None, choices=['get', 'wait', 'list']),
|
||||||
state=dict(choices=['present', 'absent']),
|
state=dict(choices=['present', 'absent']),
|
||||||
timeout=dict(required=False, default=300, type='int')
|
timeout=dict(required=False, default=300, type='int'),
|
||||||
|
recursive=dict(required=False, default=False, type='bool')
|
||||||
),
|
),
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
|
@ -175,7 +182,7 @@ class KazooCommandProxy():
|
||||||
|
|
||||||
def _absent(self, znode):
|
def _absent(self, znode):
|
||||||
if self.exists(znode):
|
if self.exists(znode):
|
||||||
self.zk.delete(znode)
|
self.zk.delete(znode, recursive=self.module.params['recursive'])
|
||||||
return True, {'changed': True, 'msg': 'The znode was deleted.'}
|
return True, {'changed': True, 'msg': 'The znode was deleted.'}
|
||||||
else:
|
else:
|
||||||
return True, {'changed': False, 'msg': 'The znode does not exist.'}
|
return True, {'changed': False, 'msg': 'The znode does not exist.'}
|
||||||
|
|
Loading…
Reference in a new issue