From 4b0d5cb8cfc9722d62ba35de9367109d1bf2f18f Mon Sep 17 00:00:00 2001 From: Stanislav Shamilov Date: Wed, 20 Nov 2024 20:08:34 +0200 Subject: [PATCH] dnf_config_manager: fix parsing for non-english locales (#9157) * dnf_config_manager: forces locale to 'C' when the module starts * adds changelog fragment * Apply suggestions from code review Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --------- Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/9157-fix-dnf_config_manager-locale.yml | 2 ++ plugins/modules/dnf_config_manager.py | 1 + 2 files changed, 3 insertions(+) create mode 100644 changelogs/fragments/9157-fix-dnf_config_manager-locale.yml diff --git a/changelogs/fragments/9157-fix-dnf_config_manager-locale.yml b/changelogs/fragments/9157-fix-dnf_config_manager-locale.yml new file mode 100644 index 0000000000..f2084dfa5f --- /dev/null +++ b/changelogs/fragments/9157-fix-dnf_config_manager-locale.yml @@ -0,0 +1,2 @@ +bugfixes: + - dnf_config_manager - forces locale to ``C`` before module starts. If the locale was set to non-English, the output of the ``dnf config-manager`` could not be parsed (https://github.com/ansible-collections/community.general/pull/9157, https://github.com/ansible-collections/community.general/issues/9046). \ No newline at end of file diff --git a/plugins/modules/dnf_config_manager.py b/plugins/modules/dnf_config_manager.py index 9ec439c225..aa2571d9f0 100644 --- a/plugins/modules/dnf_config_manager.py +++ b/plugins/modules/dnf_config_manager.py @@ -186,6 +186,7 @@ def main(): argument_spec=module_args, supports_check_mode=True ) + module.run_command_environ_update = dict(LANGUAGE='C', LC_ALL='C') if not os.path.exists(DNF_BIN): module.fail_json(msg="%s was not found" % DNF_BIN)