mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
passwordstore: Fix error detection for non-English locales (#4219)
The passwordstore lookup plugin depends on parsing GnuPG's error messages in English language. As a result, detection of a specific error failes when users set a different locale. This change corrects this by setting the `LANGUAGE` environment variable to `C` when invoking `pass`, as this only affects gettext translations. See https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html
This commit is contained in:
parent
da49c0968d
commit
77a0c139c9
2 changed files with 3 additions and 0 deletions
2
changelogs/fragments/4219-passwordstore-locale-fix.yml
Normal file
2
changelogs/fragments/4219-passwordstore-locale-fix.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- passwordstore lookup plugin - fix error detection for non-English locales (https://github.com/ansible-collections/community.general/pull/4219).
|
|
@ -229,6 +229,7 @@ class LookupModule(LookupBase):
|
|||
|
||||
# Collect pass environment variables from the plugin's parameters.
|
||||
self.env = os.environ.copy()
|
||||
self.env['LANGUAGE'] = 'C' # make sure to get errors in English as required by check_output2
|
||||
|
||||
# Set PASSWORD_STORE_DIR
|
||||
if os.path.isdir(self.paramvals['directory']):
|
||||
|
|
Loading…
Reference in a new issue