mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00: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:
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']):
|
||||
|
||||
Reference in New Issue
Block a user