You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2015/08/11 00:35:59 UTC

[08/14] incubator-ranger git commit: RANGER-588 : Take care of Ranger KMS installation even if java is not in PATH

RANGER-588 : Take care of Ranger KMS installation even if java is not in PATH

Signed-off-by: Velmurugan Periasamy <ve...@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/d1cf555b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/d1cf555b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/d1cf555b

Branch: refs/heads/tag-policy
Commit: d1cf555bfb4e53c0f71637080406eaeefbfb1622
Parents: d3d5913
Author: Gautam Borad <gb...@gmail.com>
Authored: Fri Aug 7 12:19:11 2015 +0530
Committer: Velmurugan Periasamy <ve...@apache.org>
Committed: Fri Aug 7 11:27:01 2015 -0400

----------------------------------------------------------------------
 kms/scripts/db_setup.py   | 23 +----------------------
 kms/scripts/dba_script.py | 26 ++------------------------
 2 files changed, 3 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d1cf555b/kms/scripts/db_setup.py
----------------------------------------------------------------------
diff --git a/kms/scripts/db_setup.py b/kms/scripts/db_setup.py
old mode 100644
new mode 100755
index 8116049..641376a
--- a/kms/scripts/db_setup.py
+++ b/kms/scripts/db_setup.py
@@ -72,31 +72,10 @@ def populate_global_dict():
 			key , value = each_line.strip().split("=",1)
 			key = key.strip()
 			if 'PASSWORD' in key:
-				jceks_file_path = os.path.join(RANGER_KMS_HOME, 'jceks','ranger_db.jceks')
-				statuscode,value = call_keystore(library_path,key,'',jceks_file_path,'get')
-				if statuscode == 1:
-					value = ''
+				value = ''
 			value = value.strip()
 			globalDict[key] = value
 
-def call_keystore(libpath,aliasKey,aliasValue , filepath,getorcreate):
-    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]
-        p = Popen(commandtorun,stdin=PIPE, stdout=PIPE, stderr=PIPE)
-        output, error = p.communicate()
-        statuscode = p.returncode
-        return statuscode
-    elif getorcreate == 'get':
-        commandtorun = ['java', '-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
-        return statuscode, output
-    else:
-        print 'proper command not received for input need get or create'
-
 class BaseDB(object):
 
 	def check_connection(self, db_name, db_user, db_password):

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d1cf555b/kms/scripts/dba_script.py
----------------------------------------------------------------------
diff --git a/kms/scripts/dba_script.py b/kms/scripts/dba_script.py
old mode 100644
new mode 100755
index c549fad..eb38101
--- a/kms/scripts/dba_script.py
+++ b/kms/scripts/dba_script.py
@@ -37,25 +37,6 @@ if os_name == "LINUX":
 elif os_name == "WINDOWS":
     RANGER_KMS_HOME = os.getenv("RANGER_KMS_HOME")
 
-def call_keystore(libpath,aliasKey,aliasValue , filepath,getorcreate):
-    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]
-        p = Popen(commandtorun,stdin=PIPE, stdout=PIPE, stderr=PIPE)
-        output, error = p.communicate()
-        statuscode = p.returncode
-        return statuscode
-    elif getorcreate == 'get':
-        commandtorun = ['java', '-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
-        return statuscode, output
-    else:
-        print 'proper command not received for input need get or create'
-
-
 def check_output(query):
 	if os_name == "LINUX":
 		p = subprocess.Popen(shlex.split(query), stdout=subprocess.PIPE)
@@ -83,17 +64,14 @@ def populate_global_dict():
 	elif os_name == "WINDOWS":
 		read_config_file = open(os.path.join(RANGER_KMS_HOME,'bin','install_config.properties'))
 	library_path = os.path.join(RANGER_KMS_HOME,"cred","lib","*")
-	read_config_file = open(os.path.join(RANGER_KMS_HOME,'install.properties'))
+        read_config_file = open(os.path.join(RANGER_KMS_HOME,'install.properties'))
 	for each_line in read_config_file.read().split('\n') :
 		if len(each_line) == 0 : continue
 		if re.search('=', each_line):
 			key , value = each_line.strip().split("=",1)
 			key = key.strip()
 			if 'PASSWORD' in key:
-				jceks_file_path = os.path.join(RANGER_KMS_HOME, 'jceks','ranger_db.jceks')
-				statuscode,value = call_keystore(library_path,key,'',jceks_file_path,'get')
-				if statuscode == 1:
-					value = ''
+				value = ''
 			value = value.strip()
 			globalDict[key] = value