Set manage_etc_hosts to false for cloudimage based hosts

this is needed so that our changes in /etc/hosts
are not overwritten.
This commit is contained in:
John Van de Meulebrouck Brendgard 2019-02-13 19:07:04 +01:00 committed by Patrik Lundin
parent b2272d409f
commit 3b80ba32c7
Signed by untrusted user: patlu
GPG key ID: A0A812BA2249F294

View file

@ -51,6 +51,12 @@ mv -f /etc/rc.local.new /etc/rc.local
touch /etc/run-cosmos-at-boot
# If this cloud-config is set, it will interfere with our changes to /etc/hosts
grep -q 'manage_etc_hosts: true' /etc/cloud/cloud.cfg
if [ ${?} -eq 0 ]; then
sed -i 's/manage_etc_hosts: true/manage_etc_hosts: false/g' /etc/cloud/cloud.cfg
fi
hostname $cmd_hostname
short=`echo ${cmd_hostname} | awk -F. '{print $1}'`
echo "127.0.1.1 ${cmd_hostname} ${short}" >> /etc/hosts