From 08c714f7f59dac1a853b761f3c1ca115d9cf5344 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Thu, 19 Oct 2017 08:26:35 +1000 Subject: [PATCH] Fix for UnKnownHost exception 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 --- packer/provision/baseline.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packer/provision/baseline.sh b/packer/provision/baseline.sh index 2fa347376..c1ce0bbae 100644 --- a/packer/provision/baseline.sh +++ b/packer/provision/baseline.sh @@ -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" -- 2.36.6