From 491b622041a1e5be55e533765ebdbb1f5a5f389c Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Sun, 3 Jan 2021 11:48:35 +0100 Subject: [PATCH] fix passwordstore.py to be compatible with gopass versions (#1493) * Be compatible to latest gopass versions. `gopass show` is deprecated. * add changelog fragment * Update changelogs/fragments/1493-fix_passwordstore.py_to_be_compatible_with_gopass_versions.yml Co-authored-by: Eike Waldt Co-authored-by: Felix Fontein --- ...x_passwordstore.py_to_be_compatible_with_gopass_versions.yml | 2 ++ plugins/lookup/passwordstore.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1493-fix_passwordstore.py_to_be_compatible_with_gopass_versions.yml diff --git a/changelogs/fragments/1493-fix_passwordstore.py_to_be_compatible_with_gopass_versions.yml b/changelogs/fragments/1493-fix_passwordstore.py_to_be_compatible_with_gopass_versions.yml new file mode 100644 index 0000000000..b46fc07a81 --- /dev/null +++ b/changelogs/fragments/1493-fix_passwordstore.py_to_be_compatible_with_gopass_versions.yml @@ -0,0 +1,2 @@ +bugfixes: + - passwordstore lookup plugin - always use explicit ``show`` command to retrieve password. This ensures compatibility with ``gopass`` and avoids problems when password names equal ``pass`` commands (https://github.com/ansible-collections/community.general/pull/1493). diff --git a/plugins/lookup/passwordstore.py b/plugins/lookup/passwordstore.py index ffec2ab6c4..e3d486886c 100644 --- a/plugins/lookup/passwordstore.py +++ b/plugins/lookup/passwordstore.py @@ -204,7 +204,7 @@ class LookupModule(LookupBase): def check_pass(self): try: self.passoutput = to_text( - check_output2(["pass", self.passname], env=self.env), + check_output2(["pass", "show", self.passname], env=self.env), errors='surrogate_or_strict' ).splitlines() self.password = self.passoutput[0]