You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ga...@apache.org on 2017/05/28 07:36:51 UTC
ranger git commit: RANGER-1620. Fix kafka-ranger-env.sh script to not
throw error when it is sourced from bash
Repository: ranger
Updated Branches:
refs/heads/ranger-0.7 eb386c33c -> 5cee25430
RANGER-1620. Fix kafka-ranger-env.sh script to not throw error when it is sourced from bash
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/5cee2543
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/5cee2543
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/5cee2543
Branch: refs/heads/ranger-0.7
Commit: 5cee254303eb379ecc0633943542b0f2f396cd4c
Parents: eb386c3
Author: Gautam Borad <ga...@apache.org>
Authored: Sun May 28 10:50:12 2017 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Sun May 28 13:06:21 2017 +0530
----------------------------------------------------------------------
plugin-kafka/conf/kafka-ranger-env.sh | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/5cee2543/plugin-kafka/conf/kafka-ranger-env.sh
----------------------------------------------------------------------
diff --git a/plugin-kafka/conf/kafka-ranger-env.sh b/plugin-kafka/conf/kafka-ranger-env.sh
index 232e31c..605a1eb 100755
--- a/plugin-kafka/conf/kafka-ranger-env.sh
+++ b/plugin-kafka/conf/kafka-ranger-env.sh
@@ -15,6 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-export CLASSPATH="$CLASSPATH:${script_dir}:/etc/kafka/conf:/usr/hdp/current/hadoop-hdfs-client/*:/usr/hdp/current/hadoop-hdfs-client/lib/*:/etc/hadoop/conf"
+classpathmunge () {
+ escaped=`echo $1 | sed -e 's:\*:\\\\*:g'`
+ if ! echo ${CLASSPATH} | /bin/egrep -q "(^|:)${escaped}($|:)" ; then
+ if [ "$2" = "before" ] ; then
+ CLASSPATH=$1:${CLASSPATH}
+ else
+ CLASSPATH=${CLASSPATH}:$1
+ fi
+ fi
+}
+classpathmunge /etc/kafka/conf
+classpathmunge '/usr/hdp/current/hadoop-hdfs-client/*'
+classpathmunge '/usr/hdp/current/hadoop-hdfs-client/lib/*'
+classpathmunge '/etc/hadoop/conf'
+export CLASSPATH
+unset classpathmunge