From 630616103eaf1d19918725f9c9d2e541d58e5ade Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 12 Jul 2022 09:10:25 +0200 Subject: [PATCH] dnf: fix output parsing on non-English LANGUAGE systems (#78233) Fixes #78193 --- changelogs/fragments/dnf-fix-locale-language.yml | 2 ++ lib/ansible/modules/dnf.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/dnf-fix-locale-language.yml diff --git a/changelogs/fragments/dnf-fix-locale-language.yml b/changelogs/fragments/dnf-fix-locale-language.yml new file mode 100644 index 00000000000..e30e435f0fe --- /dev/null +++ b/changelogs/fragments/dnf-fix-locale-language.yml @@ -0,0 +1,2 @@ +bugfixes: + - "dnf - fix output parsing on systems with ``LANGUAGE`` set to a language other than English (https://github.com/ansible/ansible/issues/78193)" diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py index 13dbe131874..859c72a9483 100644 --- a/lib/ansible/modules/dnf.py +++ b/lib/ansible/modules/dnf.py @@ -553,7 +553,8 @@ class DnfModule(YumDnf): def _ensure_dnf(self): locale = get_best_parsable_locale(self.module) - os.environ['LC_ALL'] = os.environ['LC_MESSAGES'] = os.environ['LANG'] = locale + os.environ['LC_ALL'] = os.environ['LC_MESSAGES'] = locale + os.environ['LANGUAGE'] = os.environ['LANG'] = locale global dnf try: