From 0e6d70697c57889c7af66757dd501f38422cf0b8 Mon Sep 17 00:00:00 2001 From: fkuep Date: Sat, 5 Jun 2021 22:38:42 +0200 Subject: [PATCH] Wire token param into consul_api #2124 (#2126) * Wire token param into consul_api #2124 * Update changelogs/fragments/2124-consul_kv-pass-token.yml Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * #2124 renamed release fragment to match pr, removed parse_params. * putting look back in, do some linting #2124 * try more linting * linting * try overwriting defaults in parse_params with get_option vals, instead of removing that function completely. * Revert "back to start, from 2nd approach: allow keyword arguments via parse_params for compatibility." This reverts commit 748be8e366d46b43cc63b740cb78cde519274342. * Revert " linting" This reverts commit 1d57374c3e539a2cb640bf1482496d80f654b7d8. * Revert " try more linting" This reverts commit 91c8d06e6af442bd130859a64afbf5d558528e74. * Revert "putting look back in, do some linting #2124" This reverts commit 87eeec71803929f08e2dbfc1bfa3c76c79ea55d0. * Revert " #2124 renamed release fragment to match pr, removed parse_params." This reverts commit d2869b2f22ad64d84945ed91145de5b52bff2676. * Revert "Update changelogs/fragments/2124-consul_kv-pass-token.yml" This reverts commit c50b1cf9d4a53fbbfaa8332ba3a7acca33909f09. * Revert "Wire token param into consul_api #2124" This reverts commit b60b6433a8000459b40c4fdcee1da4fe436729a9. * minimal chnages for this PR relative to current upstream. * superfluous newline in changlog fragment. Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/2126-consul_kv-pass-token.yml | 4 ++++ plugins/lookup/consul_kv.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/2126-consul_kv-pass-token.yml diff --git a/changelogs/fragments/2126-consul_kv-pass-token.yml b/changelogs/fragments/2126-consul_kv-pass-token.yml new file mode 100644 index 0000000000..a60fd2efcd --- /dev/null +++ b/changelogs/fragments/2126-consul_kv-pass-token.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - consul_kv lookup plugin - allow to set ``recurse``, ``index``, ``datacenter`` and ``token`` as keyword arguments + (https://github.com/ansible-collections/community.general/issues/2124). diff --git a/plugins/lookup/consul_kv.py b/plugins/lookup/consul_kv.py index 7ba7e5ac90..d567b7f687 100644 --- a/plugins/lookup/consul_kv.py +++ b/plugins/lookup/consul_kv.py @@ -171,10 +171,10 @@ class LookupModule(LookupBase): paramvals = { 'key': params[0], - 'token': None, - 'recurse': False, - 'index': None, - 'datacenter': None + 'token': self.get_option('token'), + 'recurse': self.get_option('recurse'), + 'index': self.get_option('index'), + 'datacenter': self.get_option('datacenter') } # parameters specified?