From cdf25fd15dbc4a25e49416f248b237d6f4f9a67f Mon Sep 17 00:00:00 2001 From: Wilfried Roset Date: Fri, 26 Aug 2022 17:50:55 +0200 Subject: [PATCH] consul: fix session_id not associated with key/pair Signed-off-by: Wilfried Roset --- changelogs/fragments/xxxx-consul-session-token.yaml | 3 +++ plugins/modules/clustering/consul/consul_kv.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/changelogs/fragments/xxxx-consul-session-token.yaml b/changelogs/fragments/xxxx-consul-session-token.yaml index 89ac81cb132..9cdd30bf4f1 100644 --- a/changelogs/fragments/xxxx-consul-session-token.yaml +++ b/changelogs/fragments/xxxx-consul-session-token.yaml @@ -1,2 +1,5 @@ minor_changes: - consul - adds ``token`` parameter for session (https://github.com/ansible-collections/community.general/pull/xxxx). + +bugfixes: + - consul - fix session not attached to the key/pair (https://github.com/ansible-collections/community.general/pull/xxxx). diff --git a/plugins/modules/clustering/consul/consul_kv.py b/plugins/modules/clustering/consul/consul_kv.py index 2b0391389ab..c62731f9746 100644 --- a/plugins/modules/clustering/consul/consul_kv.py +++ b/plugins/modules/clustering/consul/consul_kv.py @@ -236,6 +236,7 @@ def get_value(module): def set_value(module): consul_api = get_consul_api(module) + session = module.params.get('session') key = module.params.get('key') value = module.params.get('value') @@ -247,6 +248,7 @@ def set_value(module): if changed and not module.check_mode: changed = consul_api.kv.put(key, value, cas=module.params.get('cas'), + acquire=session, flags=module.params.get('flags')) stored = None