From 1f5a7e0e647c15be54a8cce0e2f5f3f83d4ea541 Mon Sep 17 00:00:00 2001 From: mbautin <mbautin@gmail.com> Date: Thu, 15 Nov 2012 13:44:13 -0800 Subject: [PATCH] SPARK-624: make the default local IP customizable --- core/src/main/scala/spark/Utils.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/spark/Utils.scala b/core/src/main/scala/spark/Utils.scala index 567c4b1475..9805105ea8 100644 --- a/core/src/main/scala/spark/Utils.scala +++ b/core/src/main/scala/spark/Utils.scala @@ -199,7 +199,13 @@ private object Utils extends Logging { /** * Get the local host's IP address in dotted-quad format (e.g. 1.2.3.4). */ - def localIpAddress(): String = InetAddress.getLocalHost.getHostAddress + def localIpAddress(): String = { + val defaultIpOverride = System.getenv("SPARK_DEFAULT_LOCAL_IP") + if (defaultIpOverride != null) + defaultIpOverride + else + InetAddress.getLocalHost.getHostAddress + } private var customHostname: Option[String] = None -- GitLab