[FLINK-7477] Use "hadoop classpath" to augment classpath when available

This improves the out-of-box experience on GCE and AWS, both of which
don't set a HADOOP_CLASSPATH but have "hadoop" available on the $PATH.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/0a0f6ed6
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/0a0f6ed6
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/0a0f6ed6

Branch: refs/heads/master
Commit: 0a0f6ed6c3d6cff702e4322293340274bea5e7d9
Parents: bd70a00
Author: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Authored: Fri Aug 18 16:39:41 2017 +0200
Committer: Aljoscha Krettek <aljoscha.kret...@gmail.com>
Committed: Mon Aug 21 15:44:59 2017 +0200

----------------------------------------------------------------------
 flink-dist/src/main/flink-bin/bin/config.sh | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/0a0f6ed6/flink-dist/src/main/flink-bin/bin/config.sh
----------------------------------------------------------------------
diff --git a/flink-dist/src/main/flink-bin/bin/config.sh 
b/flink-dist/src/main/flink-bin/bin/config.sh
index 69f1562..ee21306 100755
--- a/flink-dist/src/main/flink-bin/bin/config.sh
+++ b/flink-dist/src/main/flink-bin/bin/config.sh
@@ -353,6 +353,12 @@ fi
 
 
INTERNAL_HADOOP_CLASSPATHS="${HADOOP_CLASSPATH}:${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
 
+# check if the "hadoop" binary is available, if yes, use that to augment the 
CLASSPATH
+if command -v hadoop >/dev/null 2>&1; then
+    echo "Using the result of 'hadoop classpath' to augment the Hadoop 
classpath: `hadoop classpath`"
+    INTERNAL_HADOOP_CLASSPATHS="${INTERNAL_HADOOP_CLASSPATHS}:`hadoop 
classpath`"
+fi
+
 if [ -n "${HBASE_CONF_DIR}" ]; then
     # Look for hbase command in HBASE_HOME or search PATH.
     if [ -n "${HBASE_HOME}" ]; then

Reply via email to