ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v..@apache.org
Subject [2/2] ranger git commit: RANGER-1317:There are two defects in install scripts for ranger usersync process
Date Fri, 03 Feb 2017 04:30:33 GMT
RANGER-1317:There are two defects in install scripts for ranger usersync process

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


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

Branch: refs/heads/master
Commit: 9fea06dbb70adc2a0c33d5ab3b019064f571a141
Parents: 306075d
Author: zhangqiang2 <zhangqiang2@zte.com.cn>
Authored: Thu Jan 19 11:37:01 2017 +0800
Committer: Velmurugan Periasamy <vel@apache.org>
Committed: Thu Feb 2 23:30:21 2017 -0500

----------------------------------------------------------------------
 unixauthservice/scripts/install.properties |  3 +++
 unixauthservice/scripts/setup.py           | 33 +++++++++++++++++++------
 2 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/9fea06db/unixauthservice/scripts/install.properties
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/install.properties b/unixauthservice/scripts/install.properties
index a23a9aa..50e8487 100644
--- a/unixauthservice/scripts/install.properties
+++ b/unixauthservice/scripts/install.properties
@@ -13,6 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# The base path for the usersync process
+ranger_base_dir = /etc/ranger
+
 #
 # The following URL should be the base URL for connecting to the policy manager web application
 # For example:

http://git-wip-us.apache.org/repos/asf/ranger/blob/9fea06db/unixauthservice/scripts/setup.py
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/setup.py b/unixauthservice/scripts/setup.py
index d5aaf80..e20d12e 100755
--- a/unixauthservice/scripts/setup.py
+++ b/unixauthservice/scripts/setup.py
@@ -19,6 +19,7 @@ import StringIO
 import xml.etree.ElementTree as ET
 import ConfigParser
 import os,errno,sys,getopt
+import sys
 from os import listdir
 from os.path import isfile, join, dirname, basename
 from urlparse import urlparse
@@ -60,13 +61,11 @@ installTemplateDirName = join(installPropDirName,'templates')
 confDistDirName = join(installPropDirName, confDistBaseDirName)
 #ugsyncLogFolderName = join(logFolderName, 'usersync')
 nativeAuthFolderName = join(installPropDirName, 'native')
+localConfFolderName = join(installPropDirName, confBaseDirName)
+
 nativeAuthProgramName = join(nativeAuthFolderName, 'credValidator.uexe')
 pamAuthProgramName = join(nativeAuthFolderName, 'pamCredValidator.uexe')
-usersyncBaseDirFullName = join(rangerBaseDirName, usersyncBaseDirName)
-confFolderName = join(usersyncBaseDirFullName, confBaseDirName)
-localConfFolderName = join(installPropDirName, confBaseDirName)
-certFolderName = join(confFolderName, certBaseDirName)
-defaultKSFileName = join(certFolderName, defaultCertFileName)
+
 defaultKSPassword = 'UnIx529p'
 defaultDNAME = 'cn=unixauthservice,ou=authenticator,o=mycompany,c=US'
 
@@ -108,6 +107,25 @@ def populate_global_dict():
             value = value.strip()
             globalDict[key] = value
 
+def initvariable():
+	global usersyncBaseDirFullName
+	global confFolderName
+	global certFolderName
+	global defaultKSFileName
+	global rangerBaseDirName
+	try:
+		ranger_base_dir = globalDict['ranger_base_dir']
+		if (len(ranger_base_dir.strip())>1):
+			rangerBaseDirName = ranger_base_dir
+	except:
+		info = sys.exc_info()
+		print info[0], ":",info[1]
+
+	usersyncBaseDirFullName = join(rangerBaseDirName, usersyncBaseDirName)
+	confFolderName = join(usersyncBaseDirFullName, confBaseDirName)
+	certFolderName = join(confFolderName, certBaseDirName)
+	defaultKSFileName = join(certFolderName, defaultCertFileName)
+
 def archiveFile(originalFileName):
     archiveDir = dirname(originalFileName)
     archiveFileName = "." + basename(originalFileName) + "." + (strftime("%d%m%Y%H%M%S",
localtime()))
@@ -321,6 +339,7 @@ def write_env_files(exp_var_name, log_path, file_name):
 def main():
 
 	populate_global_dict()
+	initvariable()
 	logFolderName = globalDict['logdir']
 	hadoop_conf = globalDict['hadoop_conf']
         pid_dir_path = globalDict['USERSYNC_PID_DIR_PATH']
@@ -333,7 +352,7 @@ def main():
                 logFolderName = os.path.join(os.getcwd(),"logs")
 	ugsyncLogFolderName = logFolderName
 
-	dirList = [ rangerBaseDirName, usersyncBaseDirName, confFolderName, certFolderName ]
+	dirList = [ rangerBaseDirName, usersyncBaseDirFullName, confFolderName, certFolderName ]
 	for dir in dirList:
 		if (not os.path.isdir(dir)):
 			os.makedirs(dir,0750)
@@ -473,7 +492,7 @@ def main():
 
 	writeXMLUsingProperties(fn, mergeProps, outfn)
 
-	fixPermList = [ ".", usersyncBaseDirName, confFolderName, certFolderName ]
+	fixPermList = [ ".", usersyncBaseDirFullName, confFolderName, certFolderName ]
 
 	for dir in fixPermList:
 		for root, dirs, files in os.walk(dir):


Mime
View raw message