Repository: sentry Updated Branches: refs/heads/master 8d53da5fb -> 1e1499d8e
SENTRY-1823 - Fix the sentryShell script to support other types - Signed off by Alexander Kolbasov + Na Li. Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/1e1499d8 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/1e1499d8 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/1e1499d8 Branch: refs/heads/master Commit: 1e1499d8e5d553a5524394334d0eafa3795be7d0 Parents: 8d53da5 Author: Colm O hEigeartaigh <[email protected]> Authored: Fri Jun 30 09:40:40 2017 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Fri Jun 30 09:40:40 2017 +0100 ---------------------------------------------------------------------- bin/sentryShell | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/1e1499d8/bin/sentryShell ---------------------------------------------------------------------- diff --git a/bin/sentryShell b/bin/sentryShell index d21a65f..f066156 100755 --- a/bin/sentryShell +++ b/bin/sentryShell @@ -54,18 +54,19 @@ for f in ${SENTRY_HOME}/lib/plugins/*.jar; do done args=() -# get the type argument for the command, and check use the shell for hive model or for generic model. -# todo: currently, supoort hive only, need add generic model support +shell=org.apache.sentry.provider.db.tools.SentryShellHive +# get the type argument for the command while [ $# -gt 0 ]; do # Until you run out of parameters . . . if [[ "$1" = "-t" || "$1" = "--type" ]]; then - # currently, only support the hive model - if ! [[ $2 =~ ^[H|h][I|i][V|v][E|e]$ ]]; then - echo "Doesn't support the type $2!" - exit 1 - fi + case $2 in + "hive") shell=org.apache.sentry.provider.db.tools.SentryShellHive ;; + "kafka") shell=org.apache.sentry.provider.db.generic.tools.SentryShellKafka ;; + "solr") shell=org.apache.sentry.provider.db.generic.tools.SentryShellSolr ;; + *) echo "Doesn't support the type $2!"; exit 1 ;; + esac fi args+=" $1" shift done -exec $HADOOP jar ${SENTRY_HOME}/lib/${_CMD_JAR} org.apache.sentry.provider.db.tools.SentryShellHive ${args[@]} +exec $HADOOP jar ${SENTRY_HOME}/lib/${_CMD_JAR} $shell ${args[@]}
