Repository: sentry Updated Branches: refs/heads/sentry-ha-redesign a2892aa73 -> 6164b2750
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/6164b275 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/6164b275 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/6164b275 Branch: refs/heads/sentry-ha-redesign Commit: 6164b27502d6e2a243ad2e35444bbfa665e3a063 Parents: a2892aa 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:42:37 2017 +0100 ---------------------------------------------------------------------- bin/sentryShell | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/6164b275/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[@]}
