Fix hostname resolve message returned by sudo 81/52281/2
authorAnil Belur <abelur@linuxfoundation.org>
Mon, 27 Feb 2017 09:02:29 +0000 (19:02 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 28 Feb 2017 02:24:03 +0000 (12:24 +1000)
- 'sudo: unable to resolve host':
  Add hostname into /etc/hosts fixes the above error

Change-Id: Ibf9ecb10fa220324d2dd4d12fee1c6100ea72cb9
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
packer/provision/baseline.sh

index ec8a25f91bd4d9775dd17cd4335f115338e266fa..3bc6cad848442feedf2a04634b19943a05da8afa 100644 (file)
@@ -137,6 +137,9 @@ Dpkg::Options {
 
 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