Adding Script to run the CLI + adding sentry-tools to build cycle
Project: http://git-wip-us.apache.org/repos/asf/sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/10dec6b6 Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/10dec6b6 Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/10dec6b6 Branch: refs/heads/akolb-cli Commit: 10dec6b605678faef8a491191fa4a7ef788ddeb1 Parents: d9dbe56 Author: Colm O hEigeartaigh <[email protected]> Authored: Thu Oct 19 11:48:26 2017 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Thu Oct 19 11:48:26 2017 +0100 ---------------------------------------------------------------------- bin/sentryCli | 59 +++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 1 + sentry-tools/pom.xml | 2 +- 3 files changed, 61 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sentry/blob/10dec6b6/bin/sentryCli ---------------------------------------------------------------------- diff --git a/bin/sentryCli b/bin/sentryCli new file mode 100755 index 0000000..02e9edd --- /dev/null +++ b/bin/sentryCli @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# 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. + +bin=`dirname "$0"` +myhome=`cd "$bin/.."; pwd` + +if [[ -z $SENTRY_HOME ]] ; then + export SENTRY_HOME=$myhome +fi + +# check for hadoop in the path +HADOOP_IN_PATH=`which hadoop 2>/dev/null` +if [ -f ${HADOOP_IN_PATH} ]; then + HADOOP_DIR=`dirname "$HADOOP_IN_PATH"`/.. +fi +# HADOOP_HOME env variable overrides hadoop in the path +HADOOP_HOME=${HADOOP_HOME:-${HADOOP_PREFIX:-$HADOOP_DIR}} +if [ "$HADOOP_HOME" == "" ]; then + echo "Cannot find hadoop installation: \$HADOOP_HOME or \$HADOOP_PREFIX must be set or hadoop must be in the path"; + exit 4; +fi + +HADOOP=$HADOOP_HOME/bin/hadoop +if [ ! -f ${HADOOP} ]; then + echo "Cannot find hadoop installation: \$HADOOP_HOME or \$HADOOP_PREFIX must be set or hadoop must be in the path"; + exit 4; +fi + +export _CMD_JAR=${SENTRY_SHELL_JAR:-sentry-provider-db-*.jar} +for f in ${SENTRY_HOME}/lib/*.jar; do + HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${f} +done +export HADOOP_CLASSPATH + +for f in ${SENTRY_HOME}/lib/server/*.jar; do + HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${f} +done +for f in ${SENTRY_HOME}/lib/plugins/*.jar; do + HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${f} +done + +args=() +shell=org.apache.sentry.shell.SentryCli + +exec $HADOOP jar ${SENTRY_HOME}/lib/${_CMD_JAR} $shell http://git-wip-us.apache.org/repos/asf/sentry/blob/10dec6b6/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 1c05556..02cf8f7 100644 --- a/pom.xml +++ b/pom.xml @@ -627,6 +627,7 @@ limitations under the License. <module>sentry-tests</module> <module>sentry-hdfs</module> <module>sentry-solr</module> + <module>sentry-tools</module> <module>sentry-dist</module> </modules> http://git-wip-us.apache.org/repos/asf/sentry/blob/10dec6b6/sentry-tools/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-tools/pom.xml b/sentry-tools/pom.xml index ed0fb92..5d4cb2a 100644 --- a/sentry-tools/pom.xml +++ b/sentry-tools/pom.xml @@ -60,4 +60,4 @@ limitations under the License. </build> -</project> \ No newline at end of file +</project>
