diff options
author | Kaz Cheng <Etherdaemon@users.noreply.github.com> | 2016-07-16 17:53:09 +1000 |
---|---|---|
committer | René Moser <mail@renemoser.net> | 2016-07-16 09:53:09 +0200 |
commit | 4af591daef607116707036db90776c8984028258 (patch) | |
tree | 7ddd4b938b519cb5f69fde95aeacc197d05d5b41 /clustering | |
parent | 277a2b5df14c78db8e494d366800bbf9eb4c8e50 (diff) | |
download | ansible-modules-extras-4af591daef607116707036db90776c8984028258.tar.gz |
Add ability to create event and query acl rules for a given acl token (#2076)
Diffstat (limited to 'clustering')
-rw-r--r-- | clustering/consul_acl.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clustering/consul_acl.py b/clustering/consul_acl.py index 67ca6318..a30ba8ab 100644 --- a/clustering/consul_acl.py +++ b/clustering/consul_acl.py @@ -236,8 +236,12 @@ def yml_to_rules(module, yml_rules): rules.add_rule('key', Rule(rule['key'], rule['policy'])) elif ('service' in rule and 'policy' in rule): rules.add_rule('service', Rule(rule['service'], rule['policy'])) + elif ('event' in rule and 'policy' in rule): + rules.add_rule('event', Rule(rule['event'], rule['policy'])) + elif ('query' in rule and 'policy' in rule): + rules.add_rule('query', Rule(rule['query'], rule['policy'])) else: - module.fail_json(msg="a rule requires a key/service and a policy.") + module.fail_json(msg="a rule requires a key/service/event or query and a policy.") return rules template = '''%s "%s" { @@ -245,7 +249,7 @@ template = '''%s "%s" { } ''' -RULE_TYPES = ['key', 'service'] +RULE_TYPES = ['key', 'service', 'event', 'query'] class Rules: |