Repository: incubator-sentry Updated Branches: refs/heads/master eb772e637 -> b3ec11999
SENTRY-194: Sentry script should not use Hive script by default for service and tool execution ( Prasad Mujumdar via Sravya Tirukkovalur) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/b3ec1199 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/b3ec1199 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/b3ec1199 Branch: refs/heads/master Commit: b3ec119995f86bbd3bb06ff6e04f991ba611bf61 Parents: eb772e6 Author: Sravya Tirukkovalur <[email protected]> Authored: Tue May 13 08:25:39 2014 -0700 Committer: Sravya Tirukkovalur <[email protected]> Committed: Tue May 13 08:25:39 2014 -0700 ---------------------------------------------------------------------- bin/sentry | 38 ++++++++++++++++----- sentry-binding/sentry-binding-hive/pom.xml | 4 +++ sentry-binding/sentry-binding-solr/pom.xml | 1 + sentry-dist/src/main/assembly/bin.xml | 20 ++++++++++- sentry-dist/src/main/assembly/src.xml | 7 ---- sentry-policy/sentry-policy-db/pom.xml | 1 + sentry-policy/sentry-policy-search/pom.xml | 1 + sentry-provider/sentry-provider-common/pom.xml | 1 + sentry-provider/sentry-provider-db/pom.xml | 1 + sentry-provider/sentry-provider-file/pom.xml | 1 + 10 files changed, 58 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/bin/sentry ---------------------------------------------------------------------- diff --git a/bin/sentry b/bin/sentry index 0bd37e8..2990ef4 100755 --- a/bin/sentry +++ b/bin/sentry @@ -23,7 +23,24 @@ if [[ -z $SENTRY_HOME ]] ; then export SENTRY_HOME=$myhome fi -_HIVE_CMD=hive +# 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 + #check to see if the hive conf dir is given as an optional argument args=() while [ $# -gt 0 ]; do # Until you run out of parameters . . . @@ -49,16 +66,19 @@ while [ $# -gt 0 ]; do # Until you run out of parameters . . . esac done -if [[ -z "$HIVE_HOME" ]] -then - echo "HIVE_HOME must be defined either as an env variable or by the --hive-home argument" - exit 1 -fi - _CMD_JAR=sentry-core-common-*.jar -_HIVE_CMD=${HIVE_HOME}/bin/hive for f in ${SENTRY_HOME}/lib/*.jar; do HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${f} done export HADOOP_CLASSPATH -${_HIVE_CMD} --service jar ${SENTRY_HOME}/lib/${_CMD_JAR} org.apache.sentry.SentryMain ${args[@]} +if [[ -z "$HIVE_HOME" ]] +then + for f in ${SENTRY_HOME}/lib/server/*.jar; do + HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${f} + done + exec $HADOOP jar ${SENTRY_HOME}/lib/${_CMD_JAR} org.apache.sentry.SentryMain ${args[@]} +else + _HIVE_CMD=${HIVE_HOME}/bin/hive + ${_HIVE_CMD} --service jar ${SENTRY_HOME}/lib/${_CMD_JAR} org.apache.sentry.SentryMain ${args[@]} +fi + http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-binding/sentry-binding-hive/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-hive/pom.xml b/sentry-binding/sentry-binding-hive/pom.xml index 2ce4d87..4974108 100644 --- a/sentry-binding/sentry-binding-hive/pom.xml +++ b/sentry-binding/sentry-binding-hive/pom.xml @@ -53,10 +53,12 @@ limitations under the License. <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-service</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sentry</groupId> @@ -88,11 +90,13 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>${hadoop.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.mockito</groupId> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-binding/sentry-binding-solr/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-binding/sentry-binding-solr/pom.xml b/sentry-binding/sentry-binding-solr/pom.xml index 4ed491a..3ff52ea 100644 --- a/sentry-binding/sentry-binding-solr/pom.xml +++ b/sentry-binding/sentry-binding-solr/pom.xml @@ -58,6 +58,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-dist/src/main/assembly/bin.xml ---------------------------------------------------------------------- diff --git a/sentry-dist/src/main/assembly/bin.xml b/sentry-dist/src/main/assembly/bin.xml index 8d9d753..258e63c 100644 --- a/sentry-dist/src/main/assembly/bin.xml +++ b/sentry-dist/src/main/assembly/bin.xml @@ -31,7 +31,6 @@ <baseDirectory>apache-sentry-${project.version}-bin</baseDirectory> - <dependencySets> <dependencySet> <outputDirectory>lib</outputDirectory> @@ -41,9 +40,28 @@ <useTransitiveFiltering>true</useTransitiveFiltering> <excludes> <exclude>org.slf4j:*</exclude> + <exclude>org.datanucleus:*</exclude> + <exclude>com.jolbox:bonecp</exclude> + <exclude>org.apache.hive:hive-beeline</exclude> + <exclude>org.apache.derby:derby</exclude> </excludes> </dependencySet> + <dependencySet> + <outputDirectory>lib/server</outputDirectory> + <unpack>false</unpack> + <useProjectArtifact>false</useProjectArtifact> + <useStrictFiltering>true</useStrictFiltering> + <useTransitiveFiltering>true</useTransitiveFiltering> + <includes> + <include>org.datanucleus:*</include> + <include>com.jolbox:bonecp</include> + <include>org.apache.hive:hive-beeline</include> + <include>org.apache.derby:derby</include> + <include>org.apache.derby:derby</include> + </includes> + </dependencySet> </dependencySets> + <fileSets> <fileSet> <directory>${project.parent.basedir}</directory> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-dist/src/main/assembly/src.xml ---------------------------------------------------------------------- diff --git a/sentry-dist/src/main/assembly/src.xml b/sentry-dist/src/main/assembly/src.xml index 208d455..a06e521 100644 --- a/sentry-dist/src/main/assembly/src.xml +++ b/sentry-dist/src/main/assembly/src.xml @@ -62,13 +62,6 @@ </includes> <outputDirectory>/</outputDirectory> </fileSet> - <fileSet> - <directory>${project.parent.basedir}/sentry-provider/sentry-provider-db/src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - <outputDirectory>scripts/sentrystore/upgrade</outputDirectory> - </fileSet> </fileSets> </assembly> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-policy/sentry-policy-db/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-policy/sentry-policy-db/pom.xml b/sentry-policy/sentry-policy-db/pom.xml index 59498f3..b79eef2 100644 --- a/sentry-policy/sentry-policy-db/pom.xml +++ b/sentry-policy/sentry-policy-db/pom.xml @@ -31,6 +31,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-policy/sentry-policy-search/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-policy/sentry-policy-search/pom.xml b/sentry-policy/sentry-policy-search/pom.xml index 55ea3c1..9d45f71 100644 --- a/sentry-policy/sentry-policy-search/pom.xml +++ b/sentry-policy/sentry-policy-search/pom.xml @@ -36,6 +36,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-provider/sentry-provider-common/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-common/pom.xml b/sentry-provider/sentry-provider-common/pom.xml index 7c17950..664b7eb 100644 --- a/sentry-provider/sentry-provider-common/pom.xml +++ b/sentry-provider/sentry-provider-common/pom.xml @@ -36,6 +36,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sentry</groupId> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-provider/sentry-provider-db/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/pom.xml b/sentry-provider/sentry-provider-db/pom.xml index 0cda1e2..f272fb6 100644 --- a/sentry-provider/sentry-provider-db/pom.xml +++ b/sentry-provider/sentry-provider-db/pom.xml @@ -39,6 +39,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/b3ec1199/sentry-provider/sentry-provider-file/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-file/pom.xml b/sentry-provider/sentry-provider-file/pom.xml index 60c4836..836c8c8 100644 --- a/sentry-provider/sentry-provider-file/pom.xml +++ b/sentry-provider/sentry-provider-file/pom.xml @@ -35,6 +35,7 @@ limitations under the License. <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId>
