ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v..@apache.org
Subject incubator-ranger git commit: RANGER-481 : Credential helper script should use java from defined JAVA_HOME
Date Sun, 17 May 2015 15:32:01 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 0f8d0c5f7 -> cdf6df935


RANGER-481 : Credential helper script should use java from defined JAVA_HOME

Signed-off-by: Velmurugan Periasamy <vel@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/cdf6df93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/cdf6df93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/cdf6df93

Branch: refs/heads/master
Commit: cdf6df9350f7040364d8a4b0295b54589568cc23
Parents: 0f8d0c5
Author: Gautam Borad <gborad@gmail.com>
Authored: Sat May 16 22:39:43 2015 +0530
Committer: Velmurugan Periasamy <vel@apache.org>
Committed: Sun May 17 11:29:30 2015 -0400

----------------------------------------------------------------------
 security-admin/scripts/ranger_credential_helper.py | 12 ++++++++++--
 src/main/assembly/plugin-kafka.xml                 |  5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/cdf6df93/security-admin/scripts/ranger_credential_helper.py
----------------------------------------------------------------------
diff --git a/security-admin/scripts/ranger_credential_helper.py b/security-admin/scripts/ranger_credential_helper.py
index f195bc0..bc4dbb7 100644
--- a/security-admin/scripts/ranger_credential_helper.py
+++ b/security-admin/scripts/ranger_credential_helper.py
@@ -19,6 +19,14 @@ import os
 from subprocess import  Popen,PIPE
 from optparse import OptionParser
 
+if os.getenv('JAVA_HOME') is None:
+	print "[E] ---------- JAVA_HOME environment property not defined, aborting installation.
----------"
+	sys.exit(1)
+
+JAVA_BIN=os.path.join(os.getenv('JAVA_HOME'),'bin','java')
+print "Using Java:" + str(JAVA_BIN)
+
+
 
 def main():
 
@@ -43,7 +51,7 @@ def call_keystore(libpath, filepath, aliasKey, aliasValue='', getorcreate='get')
 	finalLibPath = libpath.replace('\\','/').replace('//','/')
 	finalFilePath = 'jceks://file/'+filepath.replace('\\','/').replace('//','/')
 	if getorcreate == 'create':
-		commandtorun = ['java', '-cp', finalLibPath, 'org.apache.ranger.credentialapi.buildks'
,'create', aliasKey, '-value', aliasValue, '-provider',finalFilePath]
+		commandtorun = [JAVA_BIN, '-cp', finalLibPath, 'org.apache.ranger.credentialapi.buildks'
,'create', aliasKey, '-value', aliasValue, '-provider',finalFilePath]
 		p = Popen(commandtorun,stdin=PIPE, stdout=PIPE, stderr=PIPE)
 		output, error = p.communicate()
 		statuscode = p.returncode
@@ -53,7 +61,7 @@ def call_keystore(libpath, filepath, aliasKey, aliasValue='', getorcreate='get')
 			print "Error creating Alias!! Error: " + str(error)
 		
 	elif getorcreate == 'get':
-		commandtorun = ['java', '-cp', finalLibPath, 'org.apache.ranger.credentialapi.buildks'
,'get', aliasKey, '-provider',finalFilePath]
+		commandtorun = [JAVA_BIN, '-cp', finalLibPath, 'org.apache.ranger.credentialapi.buildks'
,'get', aliasKey, '-provider',finalFilePath]
 		p = Popen(commandtorun,stdin=PIPE, stdout=PIPE, stderr=PIPE)
 		output, error = p.communicate()
 		statuscode = p.returncode

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/cdf6df93/src/main/assembly/plugin-kafka.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/plugin-kafka.xml b/src/main/assembly/plugin-kafka.xml
index b61039d..b3620bc 100644
--- a/src/main/assembly/plugin-kafka.xml
+++ b/src/main/assembly/plugin-kafka.xml
@@ -142,6 +142,11 @@
         <fileMode>755</fileMode>
     </file>
     <file>
+        <source>security-admin/scripts/ranger_credential_helper.py</source>
+        <outputDirectory>/</outputDirectory>
+        <fileMode>755</fileMode>
+    </file>
+    <file>
         <source>plugin-kafka/scripts/install.properties</source>
         <outputDirectory>/</outputDirectory>
         <destName>install.properties</destName>


Mime
View raw message