From b3521d5423d329892710b83afc88681f2195667f Mon Sep 17 00:00:00 2001 From: Sofer Athlan-Guyot Date: Tue, 22 Sep 2020 18:55:14 +0200 Subject: [PATCH] Ensure LANG env is properly set when puppet runs. When puppet run it must support UTF-8 or whatever is the locale on the host. So we make sure that we pass down the LANG to the container and that the puppet process collect it properly. Closes-Bug: #1896640 Change-Id: Ic7bd6956f869acbee6a253269d4c3972532499e2 Co-Authored-By: Sofer Athlan-Guyot Co-Authored-By: Damien Ciabrini Co-Authored-By: Daniel Bengtsson --- common/container-puppet.py | 2 ++ common/container-puppet.sh | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/common/container-puppet.py b/common/container-puppet.py index d241f4eace..053d71d9b0 100755 --- a/common/container-puppet.py +++ b/common/container-puppet.py @@ -206,6 +206,8 @@ def mp_puppet_config(*args): 'NET_HOST=%s' % os.environ.get('NET_HOST', 'false'), '--env', 'DEBUG=%s' % os.environ.get('DEBUG', 'false'), + '--env', + 'LANG=%s' % os.environ.get('LANG', 'en_US.UTF-8'), '--volume', '/etc/localtime:/etc/localtime:ro', '--volume', diff --git a/common/container-puppet.sh b/common/container-puppet.sh index c7d5a289e0..f33b1f99a8 100644 --- a/common/container-puppet.sh +++ b/common/container-puppet.sh @@ -52,14 +52,14 @@ export FACTER_uuid=$(cat /sys/class/dmi/id/product_uuid | tr '[:upper:]' '[:lowe echo 'Running puppet' # FIXME(bogdando): stdout may be falling behind of the logged syslog messages set -x -/usr/bin/puppet apply --summarize \ - --detailed-exitcodes \ - --color=false \ - --modulepath=/etc/puppet/modules:/usr/share/openstack-puppet/modules \ - $TAGS \ - $CHECK_MODE \ - /etc/config.pp \ - 2>&1 | logger -s -t puppet-user +env "LANG=${LANG:-en_US.UTF-8}" /usr/bin/puppet apply --summarize \ + --detailed-exitcodes \ + --color=false \ + --modulepath=/etc/puppet/modules:/usr/share/openstack-puppet/modules \ + $TAGS \ + $CHECK_MODE \ + /etc/config.pp \ + 2>&1 | logger -s -t puppet-user rc=${PIPESTATUS[0]} [ "$DEBUG" = "false" ] && set +x set -e