Remove the line where we add $(hostname) into /etc/hosts
from the packer provision scripts, since the node name
is obtained during spinup and not during image build time.
Update the Jenkins startup scripts so that the $(hostname)
is updated into /etc/hosts file.
Note this workaround is required only for Ubuntu flavour.
Change-Id: Ia1822426a9c61456cf7b07831289244f103f9d39
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
# disable the firewall
/bin/bash ./disable_firewall.sh
+
+# Add 'hostname' into /etc/hosts during node spinup time to avoid sudo returning
+# an 'unable to resolve host' message or some Java API's returning an unknown
+# host exception. The workaround on adding "myhostname" into /etc/nss-switch.conf
+# does not work on Ubuntu flavours.
+sed -i "/127.0.0.1/s/$/\t$(hostname)/" /etc/hosts
jenkins ALL = NOPASSWD: ALL
EOF
+# Add 'hostname' into /etc/hosts during node spinup time to avoid sudo returning
+# an 'unable to resolve host' message or some Java API's returning an unknown
+# host exception. The workaround on adding "myhostname" into /etc/nss-switch.conf
+# does not work on Ubuntu flavours.
+sed -i "/127.0.0.1/s/$/\t$(hostname)/" /etc/hosts
+
# Do the final install of OVS that the has to be done at boot time for
# some reason due to how the snapshots keep behaving.
dpkg --install /root/openvswitch-datapath-dkms* && \
EOF
- # Add hostname to /etc/hosts to fix 'unable to resolve host' issue with sudo
- sed -i "/127.0.0.1/s/$/ $(hostname)/" /etc/hosts
-
echo "---> Updating operating system"
# add additional repositories