Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 58490200C1E for ; Fri, 3 Feb 2017 05:30:34 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 56E77160B65; Fri, 3 Feb 2017 04:30:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A004F160B61 for ; Fri, 3 Feb 2017 05:30:33 +0100 (CET) Received: (qmail 47783 invoked by uid 500); 3 Feb 2017 04:30:32 -0000 Mailing-List: contact commits-help@ranger.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ranger.apache.org Delivered-To: mailing list commits@ranger.apache.org Received: (qmail 47766 invoked by uid 99); 3 Feb 2017 04:30:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2017 04:30:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6A717DFB95; Fri, 3 Feb 2017 04:30:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vel@apache.org To: commits@ranger.apache.org Date: Fri, 03 Feb 2017 04:30:33 -0000 Message-Id: <441c6671d23a46db9a4ffce490096b1e@git.apache.org> In-Reply-To: <006c823b2ea64b359d545ab4237b43ef@git.apache.org> References: <006c823b2ea64b359d545ab4237b43ef@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] ranger git commit: RANGER-1317:There are two defects in install scripts for ranger usersync process archived-at: Fri, 03 Feb 2017 04:30:34 -0000 RANGER-1317:There are two defects in install scripts for ranger usersync process Signed-off-by: Velmurugan Periasamy 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 Authored: Thu Jan 19 11:37:01 2017 +0800 Committer: Velmurugan Periasamy 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):