Repository: hadoop Updated Branches: refs/heads/trunk 3e1745d8e -> 73b9c7b82
HADOOP-10787. Rename/remove non-HADOOP_*, etc from the shell scripts. Contributed by Allen Wittenauer. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/73b9c7b8 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/73b9c7b8 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/73b9c7b8 Branch: refs/heads/trunk Commit: 73b9c7b82b0f607a5328ad7dc4170da3ac0c1af3 Parents: 3e1745d Author: Varun Vasudev <vvasu...@apache.org> Authored: Wed Nov 4 15:56:17 2015 +0530 Committer: Varun Vasudev <vvasu...@apache.org> Committed: Wed Nov 4 15:56:17 2015 +0530 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 + .../hadoop-common/src/main/bin/hadoop | 15 ++-- .../hadoop-common/src/main/bin/hadoop-daemon.sh | 6 +- .../src/main/bin/hadoop-daemons.sh | 6 +- .../src/main/bin/hadoop-functions.sh | 66 +++++++++++++---- .../src/main/bin/hadoop-layout.sh.example | 16 ++--- .../hadoop-common/src/main/bin/rcc | 4 +- .../hadoop-common/src/main/bin/slaves.sh | 6 +- .../hadoop-common/src/main/bin/start-all.sh | 6 +- .../hadoop-common/src/main/bin/stop-all.sh | 6 +- .../main/conf/hadoop-user-functions.sh.example | 10 +-- .../scripts/hadoop_add_common_to_classpath.bats | 4 +- .../hadoop_add_to_classpath_toolspath.bats | 74 ++++++++++++++++++++ .../src/test/scripts/hadoop_basic_init.bats | 2 +- .../hadoop-kms/src/main/sbin/kms.sh | 6 +- .../hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh | 6 +- .../src/main/bin/distribute-exclude.sh | 4 +- .../hadoop-hdfs/src/main/bin/hdfs | 9 ++- .../src/main/bin/refresh-namenodes.sh | 6 +- .../hadoop-hdfs/src/main/bin/start-balancer.sh | 6 +- .../hadoop-hdfs/src/main/bin/start-dfs.sh | 6 +- .../src/main/bin/start-secure-dns.sh | 6 +- .../hadoop-hdfs/src/main/bin/stop-balancer.sh | 6 +- .../hadoop-hdfs/src/main/bin/stop-dfs.sh | 6 +- .../hadoop-hdfs/src/main/bin/stop-secure-dns.sh | 6 +- hadoop-mapreduce-project/bin/mapred | 15 ++-- .../bin/mr-jobhistory-daemon.sh | 6 +- .../hadoop-sls/src/main/bin/rumen2sls.sh | 9 ++- hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh | 12 ++-- .../hadoop-yarn/bin/start-yarn.sh | 6 +- .../hadoop-yarn/bin/stop-yarn.sh | 6 +- hadoop-yarn-project/hadoop-yarn/bin/yarn | 6 +- .../hadoop-yarn/bin/yarn-daemon.sh | 6 +- .../hadoop-yarn/bin/yarn-daemons.sh | 6 +- 34 files changed, 235 insertions(+), 128 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 453efe6..dbf9700 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -32,6 +32,9 @@ Trunk (Unreleased) HADOOP-11356. Removed deprecated o.a.h.fs.permission.AccessControlException. (Li Lu via wheat9) + HADOOP-10787 Rename/remove non-HADOOP_*, etc from the shell scripts. + (aw via vvasudev) + NEW FEATURES HADOOP-6590. Add a username check for hadoop sub-commands (John Smith via http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/hadoop ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop b/hadoop-common-project/hadoop-common/src/main/bin/hadoop index ef67cc5..513b0f1 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop @@ -47,13 +47,13 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then @@ -113,8 +113,7 @@ case ${COMMAND} in ;; archive) CLASS=org.apache.hadoop.tools.HadoopArchives - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath ;; checknative) CLASS=org.apache.hadoop.util.NativeLibraryChecker @@ -133,13 +132,11 @@ case ${COMMAND} in ;; distch) CLASS=org.apache.hadoop.tools.DistCh - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath ;; distcp) CLASS=org.apache.hadoop.tools.DistCp - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath ;; fs) CLASS=org.apache.hadoop.fs.FsShell http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh index a84e0e0..5f094d6 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh @@ -22,14 +22,14 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh index 2619ab7..604eb7e 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemons.sh @@ -28,12 +28,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh index dcf1de8..453e5ba 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh @@ -233,6 +233,10 @@ function hadoop_bootstrap # the root of the Hadoop installation # See HADOOP-6255 for the expected directory structure layout + if [[ -n "${DEFAULT_LIBEXEC_DIR}" ]]; then + hadoop_error "WARNING: DEFAULT_LIBEXEC_DIR ignored. It has been replaced by HADOOP_DEFAULT_LIBEXEC_DIR." + fi + # By now, HADOOP_LIBEXEC_DIR should have been defined upstream # We can piggyback off of that to figure out where the default # HADOOP_FREFIX should be. This allows us to run without @@ -260,8 +264,10 @@ function hadoop_bootstrap YARN_LIB_JARS_DIR=${YARN_LIB_JARS_DIR:-"share/hadoop/yarn/lib"} MAPRED_DIR=${MAPRED_DIR:-"share/hadoop/mapreduce"} MAPRED_LIB_JARS_DIR=${MAPRED_LIB_JARS_DIR:-"share/hadoop/mapreduce/lib"} - # setup a default TOOL_PATH - TOOL_PATH=${TOOL_PATH:-${HADOOP_PREFIX}/share/hadoop/tools/lib/*} + + # setup a default HADOOP_TOOLS_PATH + hadoop_deprecate_envvar TOOL_PATH HADOOP_TOOLS_PATH + HADOOP_TOOLS_PATH=${HADOOP_TOOLS_PATH:-${HADOOP_PREFIX}/share/hadoop/tools/lib/*} # usage output set to zero hadoop_reset_usage @@ -616,6 +622,8 @@ function hadoop_connect_to_hosts { # shellcheck disable=SC2124 local params="$@" + local slave_file + local tmpslvnames # # ssh (or whatever) to a host @@ -624,12 +632,8 @@ function hadoop_connect_to_hosts if [[ -n "${HADOOP_SLAVES}" && -n "${HADOOP_SLAVE_NAMES}" ]] ; then hadoop_error "ERROR: Both HADOOP_SLAVES and HADOOP_SLAVE_NAME were defined. Aborting." exit 1 - fi - - if [[ -n "${HADOOP_SLAVE_NAMES}" ]] ; then - SLAVE_NAMES=${HADOOP_SLAVE_NAMES} - else - SLAVE_FILE=${HADOOP_SLAVES:-${HADOOP_CONF_DIR}/slaves} + elif [[ -z "${HADOOP_SLAVE_NAMES}" ]]; then + slave_file=${HADOOP_SLAVES:-${HADOOP_CONF_DIR}/slaves} fi # if pdsh is available, let's use it. otherwise default @@ -639,17 +643,18 @@ function hadoop_connect_to_hosts # if we were given a file, just let pdsh deal with it. # shellcheck disable=SC2086 PDSH_SSH_ARGS_APPEND="${HADOOP_SSH_OPTS}" pdsh \ - -f "${HADOOP_SSH_PARALLEL}" -w ^"${SLAVE_FILE}" $"${@// /\\ }" 2>&1 + -f "${HADOOP_SSH_PARALLEL}" -w ^"${slave_file}" $"${@// /\\ }" 2>&1 else # no spaces allowed in the pdsh arg host list # shellcheck disable=SC2086 - SLAVE_NAMES=$(echo ${SLAVE_NAMES} | tr -s ' ' ,) + tmpslvnames=$(echo ${SLAVE_NAMES} | tr -s ' ' ,) PDSH_SSH_ARGS_APPEND="${HADOOP_SSH_OPTS}" pdsh \ - -f "${HADOOP_SSH_PARALLEL}" -w "${SLAVE_NAMES}" $"${@// /\\ }" 2>&1 + -f "${HADOOP_SSH_PARALLEL}" \ + -w "${tmpslvnames}" $"${@// /\\ }" 2>&1 fi else - if [[ -z "${SLAVE_NAMES}" ]]; then - SLAVE_NAMES=$(sed 's/#.*$//;/^$/d' "${SLAVE_FILE}") + if [[ -z "${HADOOP_SLAVE_NAMES}" ]]; then + HADOOP_SLAVE_NAMES=$(sed 's/#.*$//;/^$/d' "${slave_file}") fi hadoop_connect_to_hosts_without_pdsh "${params}" fi @@ -666,7 +671,7 @@ function hadoop_connect_to_hosts_without_pdsh { # shellcheck disable=SC2124 local params="$@" - local slaves=(${SLAVE_NAMES}) + local slaves=(${HADOOP_SLAVE_NAMES}) for (( i = 0; i < ${#slaves[@]}; i++ )) do if (( i != 0 && i % HADOOP_SSH_PARALLEL == 0 )); then @@ -940,6 +945,37 @@ function hadoop_add_common_to_classpath hadoop_add_classpath "${HADOOP_COMMON_HOME}/${HADOOP_COMMON_DIR}"'/*' } +## @description Add the HADOOP_TOOLS_PATH to the classpath +## @description environment +## @audience private +## @stability evolving +## @replaceable yes +function hadoop_add_to_classpath_toolspath +{ + declare -a array + declare -i c=0 + declare -i j + declare -i i + declare idx + + if [[ -n "${HADOOP_TOOLS_PATH}" ]]; then + hadoop_debug "Adding HADOOP_TOOLS_PATH to CLASSPATH" + oldifs=${IFS} + IFS=: + for idx in ${HADOOP_TOOLS_PATH}; do + array[${c}]=${idx} + ((c=c+1)) + done + IFS=${oldifs} + ((j=c-1)) || ${QATESTMODE} + + for ((i=0; i<=j; i++)); do + hadoop_add_classpath "${array[$i]}" after + done + + fi +} + ## @description Add the user's custom classpath settings to the ## @description environment ## @audience private @@ -1868,7 +1904,7 @@ function hadoop_verify_user local uservar="HADOOP_${command}_USER" if [[ -n ${!uservar} ]]; then - if [[ ${!uservar} != ${USER} ]]; then + if [[ ${!uservar} != "${USER}" ]]; then hadoop_error "ERROR: ${command} can only be executed by ${!uservar}." exit 1 fi http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/hadoop-layout.sh.example ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-layout.sh.example b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-layout.sh.example index a44d3cb..a3f7bde 100644 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-layout.sh.example +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-layout.sh.example @@ -43,7 +43,7 @@ #### # Default location for the common/core Hadoop project -# export HADOOP_COMMON_HOME=$HADOOP_PREFIX +# export HADOOP_COMMON_HOME=${HADOOP_PREFIX} # Relative locations where components under HADOOP_COMMON_HOME are located # export HADOOP_COMMON_DIR="share/hadoop/common" @@ -55,7 +55,7 @@ #### # Default location for the HDFS subproject -# export HADOOP_HDFS_HOME=$HADOOP_PREFIX +# export HADOOP_HDFS_HOME=${HADOOP_PREFIX} # Relative locations where components under HADOOP_HDFS_HOME are located # export HDFS_DIR="share/hadoop/hdfs" @@ -66,19 +66,19 @@ #### # Default location for the YARN subproject -# export HADOOP_YARN_HOME=$HADOOP_PREFIX +# export HADOOP_YARN_HOME=${HADOOP_PREFIX} # Relative locations where components under HADOOP_YARN_HOME are located # export YARN_DIR="share/hadoop/yarn" # export YARN_LIB_JARS_DIR="share/hadoop/yarn/lib" -# Default location for the MapReduce subproject -# export HADOOP_MAPRED_HOME=$HADOOP_PREFIX - #### # MapReduce disk layout #### +# Default location for the MapReduce subproject +# export HADOOP_MAPRED_HOME=${HADOOP_PREFIX} + # Relative locations where components under HADOOP_MAPRED_HOME are located # export MAPRED_DIR="share/hadoop/mapreduce" # export MAPRED_LIB_JARS_DIR="share/hadoop/mapreduce/lib" @@ -87,7 +87,7 @@ # Misc paths #### -# setup a default TOOL_PATH, where things like distcp lives +# setup a default HADOOP_TOOLS_PATH, where things like distcp lives # note that this path only gets added for certain commands and not # part of the general classpath -# export TOOL_PATH="$HADOOP_PREFIX/share/hadoop/tools/lib/*" +# export HADOOP_TOOLS_PATH="${HADOOP_PREFIX}/share/hadoop/tools/lib/*" http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/rcc ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/rcc b/hadoop-common-project/hadoop-common/src/main/bin/rcc index 512fc2c..c2ec942 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/rcc +++ b/hadoop-common-project/hadoop-common/src/main/bin/rcc @@ -21,8 +21,8 @@ bin=$(cd -P -- "$(dirname -- "$this")" >/dev/null && pwd -P) script="$(basename -- "$this")" this="$bin/$script" -DEFAULT_LIBEXEC_DIR="$bin"/../libexec -HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR} +HADOOP_DEFAULT_LIBEXEC_DIR="$bin"/../libexec +HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR} # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true . "$HADOOP_LIBEXEC_DIR/hadoop-config.sh" http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/slaves.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/slaves.sh b/hadoop-common-project/hadoop-common/src/main/bin/slaves.sh index 2fdf18b..5859da0 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/slaves.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/slaves.sh @@ -34,14 +34,14 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/start-all.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/start-all.sh b/hadoop-common-project/hadoop-common/src/main/bin/start-all.sh index edd1b93..845ca37 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/start-all.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/start-all.sh @@ -22,14 +22,14 @@ exit 1 # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/bin/stop-all.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/bin/stop-all.sh b/hadoop-common-project/hadoop-common/src/main/bin/stop-all.sh index 55424d8..df7ae8d 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/stop-all.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/stop-all.sh @@ -23,14 +23,14 @@ exit 1 # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/main/conf/hadoop-user-functions.sh.example ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/conf/hadoop-user-functions.sh.example b/hadoop-common-project/hadoop-common/src/main/conf/hadoop-user-functions.sh.example index 3cf5776..91a2d8b 100644 --- a/hadoop-common-project/hadoop-common/src/main/conf/hadoop-user-functions.sh.example +++ b/hadoop-common-project/hadoop-common/src/main/conf/hadoop-user-functions.sh.example @@ -94,6 +94,8 @@ # #function hadoop_connect_to_hosts_without_pdsh #{ +# local tmpslvnames +# # # quoting here gets tricky. it's easier to push it into a function # # so that we don't have to deal with it. However... # # xargs can't use a function so instead we'll export it out @@ -106,9 +108,9 @@ # # list with each hostname read from stdin/pipe. But it consider one # # line as one argument while reading from stdin/pipe. So place each # # hostname in different lines while passing via pipe. -# SLAVE_NAMES=$(echo "$SLAVE_NAMES" | tr ' ' '\n' ) -# echo "${SLAVE_NAMES}" | \ -# xargs -n 1 -P"${HADOOP_SSH_PARALLEL}" \ -# -I {} bash -c -- "hadoop_actual_ssh {} ${params}" +# tmpslvnames=$(echo "${HADOOP_SLAVE_NAMES}" | tr ' ' '\n' ) +# echo "${tmpslvnames}" | \ +# xargs -n 1 -P"${HADOOP_SSH_PARALLEL}" \ +# -I {} bash -c -- "hadoop_actual_ssh {} ${params}" # wait #} http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_common_to_classpath.bats ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_common_to_classpath.bats b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_common_to_classpath.bats index 14e75a6..b58142f 100644 --- a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_common_to_classpath.bats +++ b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_common_to_classpath.bats @@ -24,7 +24,7 @@ freetheclasses () { HADOOP_COMMON_HOME \ HADOOP_COMMON_LIB_JARS_DIR \ HADOOP_ENABLE_BUILD_PATHS ; do - unset ${!j} + unset ${j} done } @@ -68,4 +68,4 @@ createdirs () { set -e echo ">${CLASSPATH}<" [ "${CLASSPATH}" = "${TMP}/hadoop-common/target/classes:${TMP}/commonlibjars/*:${TMP}/commondir/*" ] - } \ No newline at end of file + } http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_to_classpath_toolspath.bats ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_to_classpath_toolspath.bats b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_to_classpath_toolspath.bats new file mode 100644 index 0000000..a8a9bca --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_add_to_classpath_toolspath.bats @@ -0,0 +1,74 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load hadoop-functions_test_helper + +freetheclasses () { + local j + + for j in HADOOP_TOOLS_PATH \ + CLASSPATH; do + unset ${j} + done +} + +createdirs () { + local j + + for j in new old foo bar baz; do + mkdir -p "${TMP}/${j}" + done +} + +@test "hadoop_add_to_classpath_toolspath (nothing)" { + freetheclasses + hadoop_add_to_classpath_toolspath + [ -z "${CLASSPATH}" ] +} + +@test "hadoop_add_to_classpath_toolspath (none)" { + freetheclasses + CLASSPATH=test + hadoop_add_to_classpath_toolspath + [ "${CLASSPATH}" = "test" ] +} + +@test "hadoop_add_to_classpath_toolspath (only)" { + freetheclasses + createdirs + HADOOP_TOOLS_PATH="${TMP}/new" + hadoop_add_to_classpath_toolspath + [ "${CLASSPATH}" = "${TMP}/new" ] +} + +@test "hadoop_add_to_classpath_toolspath (1+1)" { + freetheclasses + createdirs + CLASSPATH=${TMP}/foo + HADOOP_TOOLS_PATH=${TMP}/foo + hadoop_add_to_classpath_toolspath + echo ">${CLASSPATH}<" + [ ${CLASSPATH} = "${TMP}/foo" ] +} + +@test "hadoop_add_to_classpath_toolspath (3+2)" { + freetheclasses + createdirs + CLASSPATH=${TMP}/foo:${TMP}/bar:${TMP}/baz + HADOOP_TOOLS_PATH=${TMP}/new:${TMP}/old + hadoop_add_to_classpath_toolspath + echo ">${CLASSPATH}<" + [ ${CLASSPATH} = "${TMP}/foo:${TMP}/bar:${TMP}/baz:${TMP}/new:${TMP}/old" ] +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_basic_init.bats ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_basic_init.bats b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_basic_init.bats index 02ed4a1..6a5e3f2 100644 --- a/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_basic_init.bats +++ b/hadoop-common-project/hadoop-common/src/test/scripts/hadoop_basic_init.bats @@ -41,7 +41,7 @@ basicinitsetup () { HADOOP_YARN_HOME" for j in ${testvars}; do - unset ${!j} + unset ${j} done HADOOP_PREFIX=${TMP} http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh b/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh index 1191eb9..4ed4725 100755 --- a/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh +++ b/hadoop-common-project/hadoop-kms/src/main/sbin/kms.sh @@ -31,13 +31,13 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/kms-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh index 9b819aa..18c1af0 100755 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/sbin/httpfs.sh @@ -31,13 +31,13 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/httpfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/distribute-exclude.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/distribute-exclude.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/distribute-exclude.sh index 3c0b9af..cfd44e3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/distribute-exclude.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/distribute-exclude.sh @@ -36,8 +36,8 @@ bin=`dirname "$0"` bin=`cd "$bin"; pwd` -DEFAULT_LIBEXEC_DIR="$bin"/../libexec -HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR} +HADOOP_DEFAULT_LIBEXEC_DIR="$bin"/../libexec +HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR} . $HADOOP_LIBEXEC_DIR/hdfs-config.sh if [ "$1" = '' ] ; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs index 8b1ede8..3739ccb 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/hdfs @@ -60,13 +60,13 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then @@ -155,8 +155,7 @@ case ${COMMAND} in ;; haadmin) CLASS=org.apache.hadoop.hdfs.tools.DFSHAAdmin - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS" HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}" ;; http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/refresh-namenodes.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/refresh-namenodes.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/refresh-namenodes.sh index 3bac3b4..318a282 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/refresh-namenodes.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/refresh-namenodes.sh @@ -22,14 +22,14 @@ # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-balancer.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-balancer.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-balancer.sh index cbf6170..32ca2b2 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-balancer.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-balancer.sh @@ -31,12 +31,12 @@ bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-dfs.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-dfs.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-dfs.sh index f5ca410..9c5a172 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-dfs.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-dfs.sh @@ -30,12 +30,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-secure-dns.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-secure-dns.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-secure-dns.sh index 82aa7aa..f904640 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-secure-dns.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/start-secure-dns.sh @@ -27,12 +27,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-balancer.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-balancer.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-balancer.sh index 268cf90..bb51a8a 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-balancer.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-balancer.sh @@ -29,12 +29,12 @@ bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-dfs.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-dfs.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-dfs.sh index 549e893..cc0d11d 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-dfs.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-dfs.sh @@ -29,12 +29,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-secure-dns.sh ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-secure-dns.sh b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-secure-dns.sh index e263580..816a3e3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-secure-dns.sh +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/bin/stop-secure-dns.sh @@ -27,12 +27,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hdfs-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-mapreduce-project/bin/mapred ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/bin/mapred b/hadoop-mapreduce-project/bin/mapred index 2d56a8d..9bf9330 100755 --- a/hadoop-mapreduce-project/bin/mapred +++ b/hadoop-mapreduce-project/bin/mapred @@ -37,12 +37,12 @@ bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/mapred-config.sh" ]]; then @@ -68,15 +68,13 @@ case ${COMMAND} in ;; archive) CLASS=org.apache.hadoop.tools.HadoopArchives - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS" HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}" ;; archive-logs) CLASS=org.apache.hadoop.tools.HadoopArchiveLogs - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS" HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}" ;; @@ -85,8 +83,7 @@ case ${COMMAND} in ;; distcp) CLASS=org.apache.hadoop.tools.DistCp - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS" HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}" ;; http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-mapreduce-project/bin/mr-jobhistory-daemon.sh ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/bin/mr-jobhistory-daemon.sh b/hadoop-mapreduce-project/bin/mr-jobhistory-daemon.sh index abc70d9..57b1ebd 100644 --- a/hadoop-mapreduce-project/bin/mr-jobhistory-daemon.sh +++ b/hadoop-mapreduce-project/bin/mr-jobhistory-daemon.sh @@ -22,14 +22,14 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh b/hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh index f4fdabd..c5b6d84 100644 --- a/hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh +++ b/hadoop-tools/hadoop-sls/src/main/bin/rumen2sls.sh @@ -55,8 +55,7 @@ function parse_args() function calculate_classpath() { - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" + hadoop_add_to_classpath_toolspath } function run_sls_generator() @@ -79,14 +78,14 @@ function run_sls_generator() # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh b/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh index d1409bf..29b0de7 100644 --- a/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh +++ b/hadoop-tools/hadoop-sls/src/main/bin/slsrun.sh @@ -68,9 +68,9 @@ function parse_args() fi } -function calculate_classpath() { - hadoop_debug "Injecting TOOL_PATH into CLASSPATH" - hadoop_add_classpath "${TOOL_PATH}" +function calculate_classpath +{ + hadoop_add_to_classpath_toolspath hadoop_debug "Injecting ${HADOOP_PREFIX}/share/hadoop/tools/sls/html into CLASSPATH" hadoop_add_classpath "${HADOOP_PREFIX}/share/hadoop/tools/sls/html" } @@ -106,14 +106,14 @@ function run_simulation() { # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-yarn-project/hadoop-yarn/bin/start-yarn.sh ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/bin/start-yarn.sh b/hadoop-yarn-project/hadoop-yarn/bin/start-yarn.sh index 1172c60..f462fad 100755 --- a/hadoop-yarn-project/hadoop-yarn/bin/start-yarn.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/start-yarn.sh @@ -27,12 +27,12 @@ bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-yarn-project/hadoop-yarn/bin/stop-yarn.sh ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/bin/stop-yarn.sh b/hadoop-yarn-project/hadoop-yarn/bin/stop-yarn.sh index ffa4cfc..3305989 100755 --- a/hadoop-yarn-project/hadoop-yarn/bin/stop-yarn.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/stop-yarn.sh @@ -27,12 +27,12 @@ bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-yarn-project/hadoop-yarn/bin/yarn ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn b/hadoop-yarn-project/hadoop-yarn/bin/yarn index f0bed9b..7f05dad 100755 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn @@ -51,13 +51,13 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else bin=$(cd -P -- "$(dirname -- "${MYNAME}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemon.sh ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemon.sh b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemon.sh index 75294fe..2f886f2 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemon.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemon.sh @@ -22,14 +22,14 @@ function hadoop_usage # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else this="${BASH_SOURCE-$0}" bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then http://git-wip-us.apache.org/repos/asf/hadoop/blob/73b9c7b8/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh index 75fb1f8..4ef0864 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn-daemons.sh @@ -26,12 +26,12 @@ bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P) # let's locate libexec... if [[ -n "${HADOOP_PREFIX}" ]]; then - DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_PREFIX}/libexec" else - DEFAULT_LIBEXEC_DIR="${bin}/../libexec" + HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../libexec" fi -HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}" +HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}" # shellcheck disable=SC2034 HADOOP_NEW_CONFIG=true if [[ -f "${HADOOP_LIBEXEC_DIR}/yarn-config.sh" ]]; then