Fix for UnKnownHost exception 97/64497/2
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 18 Oct 2017 22:26:35 +0000 (08:26 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Thu, 19 Oct 2017 01:01:43 +0000 (11:01 +1000)
This fix ensures that the system binds the hostname to the assigned IP
without any changes required to /etc/hosts.

https://lists.opendaylight.org/pipermail/release/2017-October/012736.html

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

index 2fa3473766d0aa1316776b60be5c0716141625e6..c1ce0bbaeab85be7b614808827a8626c5e1a1806 100644 (file)
@@ -440,6 +440,11 @@ all_systems() {
             echo "No extra steps for $FACTER_OS"
         ;;
     esac
+
+    # Update /etc/nss-switch.conf to map hostname with IP instead of using `localhost`
+    # from /etc/hosts which is required by some of the Java API's to avoid
+    # Java UnknownHostException: "Name or service not known" error.
+    sed -i "/^hosts:/s/$/ myhostname/" /etc/nsswitch.conf
 }
 
 echo "---> Attempting to detect OS"