From 1d0fc9aa85b3ad3326b878de49b748413dee1dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BA=B7ng=20Minh=20D=C5=A9ng?= Date: Mon, 30 Mar 2020 15:41:57 -0700 Subject: [PATCH] [SPARK-29574][K8S][FOLLOWUP] Fix bash comparison error in Docker entrypoint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What changes were proposed in this pull request? A small change to fix an error in Docker `entrypoint.sh` ### Why are the changes needed? When spark running on Kubernetes, I got the following logs: ```log + '[' -n ']' + '[' -z ']' ++ /bin/hadoop classpath /opt/entrypoint.sh: line 62: /bin/hadoop: No such file or directory + export SPARK_DIST_CLASSPATH= + SPARK_DIST_CLASSPATH= ``` This is because you are missing some quotes on bash comparisons. ### Does this PR introduce any user-facing change? No ## How was this patch tested? CI Closes #28075 from dungdm93/patch-1. Authored-by: Đặng Minh Dũng Signed-off-by: Dongjoon Hyun --- .../docker/src/main/dockerfiles/spark/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh index 05ab782cae..813a70c6e7 100755 --- a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh +++ b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh @@ -58,8 +58,8 @@ fi # If HADOOP_HOME is set and SPARK_DIST_CLASSPATH is not set, set it here so Hadoop jars are available to the executor. # It does not set SPARK_DIST_CLASSPATH if already set, to avoid overriding customizations of this value from elsewhere e.g. Docker/K8s. -if [ -n ${HADOOP_HOME} ] && [ -z ${SPARK_DIST_CLASSPATH} ]; then - export SPARK_DIST_CLASSPATH=$($HADOOP_HOME/bin/hadoop classpath) +if [ -n "${HADOOP_HOME}" ] && [ -z "${SPARK_DIST_CLASSPATH}" ]; then + export SPARK_DIST_CLASSPATH="$($HADOOP_HOME/bin/hadoop classpath)" fi if ! [ -z ${HADOOP_CONF_DIR+x} ]; then