HDFS-7591. hdfs classpath command should support same options as hadoop classpath. (Contributed by Varun Saxena)

This commit is contained in:
Arpit Agarwal 2015-01-15 11:02:17 -08:00
parent ce29074685
commit a6efbb21c2
5 changed files with 29 additions and 11 deletions

View File

@ -124,13 +124,7 @@ case ${COMMAND} in
CLASS=org.apache.hadoop.util.NativeLibraryChecker
;;
classpath)
if [[ "$#" -eq 1 ]]; then
CLASS=org.apache.hadoop.util.Classpath
else
hadoop_finalize
echo "${CLASSPATH}"
exit 0
fi
hadoop_do_classpath_subcommand "$@"
;;
credential)
CLASS=org.apache.hadoop.security.alias.CredentialShell

View File

@ -1240,3 +1240,14 @@ function hadoop_verify_user
fi
fi
}
function hadoop_do_classpath_subcommand
{
if [[ "$#" -gt 0 ]]; then
CLASS=org.apache.hadoop.util.Classpath
else
hadoop_finalize
echo "${CLASSPATH}"
exit 0
fi
}

View File

@ -133,6 +133,9 @@ Trunk (Unreleased)
type instead of concrete classes Block and ReplicaInfo. (David Powell
and Joe Pallas via szetszwo)
HDFS-7591. hdfs classpath command should support same options as hadoop
classpath (Varun Saxena via Arpit Agarwal)
OPTIMIZATIONS
BUG FIXES

View File

@ -94,9 +94,7 @@ case ${COMMAND} in
CLASS=org.apache.hadoop.hdfs.tools.CacheAdmin
;;
classpath)
hadoop_finalize
echo "${CLASSPATH}"
exit
hadoop_do_classpath_subcommand "$@"
;;
crypto)
CLASS=org.apache.hadoop.hdfs.tools.CryptoAdmin

View File

@ -51,7 +51,15 @@ if "%1" == "--loglevel" (
goto print_usage
)
set hdfscommands=dfs namenode secondarynamenode journalnode zkfc datanode dfsadmin haadmin fsck balancer jmxget oiv oev fetchdt getconf groups snapshotDiff lsSnapshottableDir cacheadmin mover storagepolicies
if %hdfs-command% == classpath (
if not defined hdfs-command-arguments (
@rem No need to bother starting up a JVM for this simple case.
@echo %CLASSPATH%
exit /b
)
)
set hdfscommands=dfs namenode secondarynamenode journalnode zkfc datanode dfsadmin haadmin fsck balancer jmxget oiv oev fetchdt getconf groups snapshotDiff lsSnapshottableDir cacheadmin mover storagepolicies classpath
for %%i in ( %hdfscommands% ) do (
if %hdfs-command% == %%i set hdfscommand=true
)
@ -122,6 +130,10 @@ goto :eof
set CLASS=org.apache.hadoop.hdfs.tools.JMXGet
goto :eof
:classpath
set CLASS=org.apache.hadoop.util.Classpath
goto :eof
:oiv
set CLASS=org.apache.hadoop.hdfs.tools.offlineImageViewer.OfflineImageViewerPB
goto :eof