Skip to content

Commit

Permalink
Fix returnall for gopass (#5027) (#5029)
Browse files Browse the repository at this point in the history
* Fix returnall for gopass

Gopass was always given the --password flag, despite there being no need for this.

* Add changelog fragment

Co-authored-by: Sylvia van Os <sylvia.van.os@politie.nl>
(cherry picked from commit 3eb29eb)

Co-authored-by: Sylvia van Os <sylvia@hackerchick.me>
  • Loading branch information
patchback[bot] and TheLastProject authored Jul 29, 2022
1 parent 66cbd92 commit 3020b30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/5027-fix-returnall-for-gopass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- passwordstore lookup plugin - fix ``returnall`` for gopass (https://github.com/ansible-collections/community.general/pull/5027).
5 changes: 2 additions & 3 deletions plugins/lookup/passwordstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ def __init__(self, loader=None, templar=None, **kwargs):
def is_real_pass(self):
if self.realpass is None:
try:
self.passoutput = to_text(
passoutput = to_text(
check_output2([self.pass_cmd, "--version"], env=self.env),
errors='surrogate_or_strict'
)
self.realpass = 'pass: the standard unix password manager' in self.passoutput
self.realpass = 'pass: the standard unix password manager' in passoutput
except (subprocess.CalledProcessError) as e:
raise AnsibleError(e)

Expand Down Expand Up @@ -331,7 +331,6 @@ def check_pass(self):
try:
self.passoutput = to_text(
check_output2([self.pass_cmd, 'show'] +
(['--password'] if self.backend == 'gopass' else []) +
[self.passname], env=self.env),
errors='surrogate_or_strict'
).splitlines()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,6 @@
if [ "$1" = "--version" ]; then
exit 2
fi
if [ "$1" = "show" ] && [ "$2" != "--password" ]; then
exit 3
fi
echo "gopass_ok"
dest: "{{ gopasspath }}"
mode: '0755'
Expand Down

0 comments on commit 3020b30

Please sign in to comment.