HADOOP-11092. hadoop shell commands should print usage if not given a class (aw)

This commit is contained in:
Allen Wittenauer 2014-09-23 12:24:23 -07:00
parent 5338ac416a
commit 3dc28e2052
6 changed files with 28 additions and 11 deletions

View File

@ -126,6 +126,9 @@ Trunk (Unreleased)
HADOOP-11041. VersionInfo specifies subversion (Tsuyoshi OZAWA via aw)
HADOOP-11092. hadoop shell commands should print usage if not given a
a class (aw)
BUG FIXES
HADOOP-9451. Fault single-layer config if node group topology is enabled.

View File

@ -162,11 +162,11 @@ case ${COMMAND} in
version)
CLASS=org.apache.hadoop.util.VersionInfo
;;
-*|hdfs)
hadoop_exit_with_usage 1
;;
*)
CLASS="${COMMAND}"
if ! hadoop_validate_classname "${CLASS}"; then
hadoop_exit_with_usage 1
fi
;;
esac

View File

@ -279,6 +279,17 @@ function hadoop_connect_to_hosts
fi
}
function hadoop_validate_classname
{
local class=$1
shift 1
if [[ ! ${class} =~ \. ]]; then
return 1
fi
return 0
}
function hadoop_add_param
{
#

View File

@ -222,11 +222,11 @@ case ${COMMAND} in
hadoop_debug "Appending HADOOP_ZKFC_OPTS onto HADOOP_OPTS"
HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_ZKFC_OPTS}"
;;
-*)
hadoop_exit_with_usage 1
;;
*)
CLASS="${COMMAND}"
if ! hadoop_validate_classname "${CLASS}"; then
hadoop_exit_with_usage 1
fi
;;
esac

View File

@ -118,8 +118,11 @@ case ${COMMAND} in
hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS"
HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}"
;;
-*|*)
*)
CLASS="${COMMAND}"
if ! hadoop_validate_classname "${CLASS}"; then
hadoop_exit_with_usage 1
fi
;;
esac

View File

@ -154,11 +154,11 @@ case "${COMMAND}" in
hadoop_debug "Append YARN_CLIENT_OPTS onto YARN_OPTS"
YARN_OPTS="${YARN_OPTS} ${YARN_CLIENT_OPTS}"
;;
-*)
hadoop_exit_with_usage 1
;;
*)
CLASS="${COMMAND}"
if ! hadoop_validate_classname "${CLASS}"; then
hadoop_exit_with_usage 1
fi
;;
esac