1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix returnall for gopass (#5027)

* 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>
This commit is contained in:
Sylvia van Os 2022-07-29 14:24:15 +02:00 committed by GitHub
parent c64dd16f1c
commit 3eb29eb4b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- passwordstore lookup plugin - fix ``returnall`` for gopass (https://github.com/ansible-collections/community.general/pull/5027).

View file

@ -261,11 +261,11 @@ class LookupModule(LookupBase):
def is_real_pass(self): def is_real_pass(self):
if self.realpass is None: if self.realpass is None:
try: try:
self.passoutput = to_text( passoutput = to_text(
check_output2([self.pass_cmd, "--version"], env=self.env), check_output2([self.pass_cmd, "--version"], env=self.env),
errors='surrogate_or_strict' 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: except (subprocess.CalledProcessError) as e:
raise AnsibleError(e) raise AnsibleError(e)
@ -331,7 +331,6 @@ class LookupModule(LookupBase):
try: try:
self.passoutput = to_text( self.passoutput = to_text(
check_output2([self.pass_cmd, 'show'] + check_output2([self.pass_cmd, 'show'] +
(['--password'] if self.backend == 'gopass' else []) +
[self.passname], env=self.env), [self.passname], env=self.env),
errors='surrogate_or_strict' errors='surrogate_or_strict'
).splitlines() ).splitlines()

View file

@ -318,9 +318,6 @@
if [ "$1" = "--version" ]; then if [ "$1" = "--version" ]; then
exit 2 exit 2
fi fi
if [ "$1" = "show" ] && [ "$2" != "--password" ]; then
exit 3
fi
echo "gopass_ok" echo "gopass_ok"
dest: "{{ gopasspath }}" dest: "{{ gopasspath }}"
mode: '0755' mode: '0755'