Skip to content

Commit

Permalink
puppet_utils: Do not force lang for cmd (ansible-collections#8001)
Browse files Browse the repository at this point in the history
puppet_utils: Add option to set LANG for puppet execution

Add option `environment_lang` to force the LANG when executing the
puppet agent. The default is the `C` LANG
  • Loading branch information
Knalltuete5000 authored and aretrosen committed Apr 22, 2024
1 parent 4a16f39 commit 17afd0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/puppet_lang_force.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- puppet - add option ``environment_lang`` to set the environment language encoding. Defaults to lang ``C``. It is recommended
to set it to ``C.UTF-8`` or ``en_US.UTF-8`` depending on what is available on your system. (https://github.com/ansible-collections/community.general/issues/8000)
1 change: 1 addition & 0 deletions plugins/module_utils/puppet.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@ def execute_func(execute, manifest):
verbose=cmd_runner_fmt.as_bool("--verbose"),
),
check_rc=False,
force_lang=module.params["environment_lang"],
)
return runner
10 changes: 10 additions & 0 deletions plugins/modules/puppet.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@
- Whether to print file changes details
type: bool
default: false
environment_lang:
description:
- The lang environment to use when running the puppet agent.
- The default value, V(C), is supported on every system, but can lead to encoding errors if UTF-8 is used in the output
- Use V(C.UTF-8) or V(en_US.UTF-8) or similar UTF-8 supporting locales in case of problems. You need to make sure
the selected locale is supported on the system the puppet agent runs on.
type: str
default: C
version_added: 8.6.0
requirements:
- puppet
author:
Expand Down Expand Up @@ -208,6 +217,7 @@ def main():
debug=dict(type='bool', default=False),
verbose=dict(type='bool', default=False),
use_srv_records=dict(type='bool'),
environment_lang=dict(type='str', default='C'),
),
supports_check_mode=True,
mutually_exclusive=[
Expand Down

0 comments on commit 17afd0e

Please sign in to comment.