[cloud][lxc] Prevent hostname to be set (#22246)

If the host .bashrc holds a var named HOSTNAME, the container
where the lxc_container module will attach to will inherit from
this var, potentially breaking some applications (like rabbitmqctl)
due to an incorrect $HOSTNAME reported in the container.
This commit is contained in:
Jean-Philippe Evrard 2017-03-03 18:33:41 +00:00 committed by Ryan Brown
parent f53921093f
commit 19b49a9224

View file

@ -541,6 +541,7 @@ ATTACH_TEMPLATE = """#!/usr/bin/env bash
pushd "$(getent passwd $(whoami)|cut -f6 -d':')"
if [[ -f ".bashrc" ]];then
source .bashrc
unset HOSTNAME
fi
popd