Merge "Fix for UnKnownHost exception"
authorSam Hague <shague@redhat.com>
Fri, 20 Oct 2017 00:36:10 +0000 (00:36 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 20 Oct 2017 00:36:10 +0000 (00:36 +0000)
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"