Repository: incubator-ranger
Updated Branches:
  refs/heads/master 017826011 -> 00c00253e


RANGER-867.1 : Add Kerberos support for ranger admin and clients (Fix
        setup issues)


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

Branch: refs/heads/master
Commit: 00c00253eda9ec63e5876a061d99490d9cdf3753
Parents: 0178260
Author: Gautam Borad <[email protected]>
Authored: Thu Apr 21 18:15:33 2016 +0530
Committer: Gautam Borad <[email protected]>
Committed: Thu Apr 21 18:15:33 2016 +0530

----------------------------------------------------------------------
 tagsync/scripts/setup.py         | 32 +++++++++++++++++---------------
 unixauthservice/scripts/setup.py | 34 ++++++++++++++++++----------------
 2 files changed, 35 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/00c00253/tagsync/scripts/setup.py
----------------------------------------------------------------------
diff --git a/tagsync/scripts/setup.py b/tagsync/scripts/setup.py
index 1abb1c8..1e74a47 100755
--- a/tagsync/scripts/setup.py
+++ b/tagsync/scripts/setup.py
@@ -292,17 +292,6 @@ def main():
        populate_global_dict()
        hadoop_conf = globalDict['hadoop_conf']
 
-       hadoop_conf_full_path = os.path.join(hadoop_conf, hadoopConfFileName)
-        tagsync_conf_full_path = 
os.path.join(tagsyncBaseDirFullName,confBaseDirName,hadoopConfFileName)
-        if not isfile(hadoop_conf_full_path):
-                print "WARN: core-site.xml file not found in provided hadoop 
conf path..."
-               f = open(tagsync_conf_full_path, "w")
-                f.write("<configuration></configuration>")
-                f.close()
-       else:
-               if os.path.islink(tagsync_conf_full_path):
-                       os.remove(tagsync_conf_full_path)
-
        dirList = [ rangerBaseDirName, tagsyncBaseDirFullName, confFolderName ]
        for dir in dirList:
                if (not os.path.isdir(dir)):
@@ -384,14 +373,14 @@ def main():
                groupName = mergeProps[unixGroupProp]
 
        try:
-               ownerId = pwd.getpwnam(ownerName).pw_uid
+               groupId = grp.getgrnam(groupName).gr_gid
        except KeyError, e:
-               ownerId = createUser(ownerName, groupName)
+               groupId = createGroup(groupName)
 
        try:
-               groupId = grp.getgrnam(groupName).gr_gid
+               ownerId = pwd.getpwnam(ownerName).pw_uid
        except KeyError, e:
-               groupId = createGroup(groupId)
+               ownerId = createUser(ownerName, groupName)
 
        os.chown(logFolderName,ownerId,groupId)
        os.chown(tagsyncLogFolderName,ownerId,groupId)
@@ -433,6 +422,19 @@ def main():
        os.chown(os.path.join(confBaseDirName, 
ENV_HADOOP_CONF_FILE),ownerId,groupId)
         os.chmod(os.path.join(confBaseDirName, ENV_HADOOP_CONF_FILE),0755)
 
+       hadoop_conf_full_path = os.path.join(hadoop_conf, hadoopConfFileName)
+        tagsync_conf_full_path = 
os.path.join(tagsyncBaseDirFullName,confBaseDirName,hadoopConfFileName)
+        if not isfile(hadoop_conf_full_path):
+                print "WARN: core-site.xml file not found in provided hadoop 
conf path..."
+               f = open(tagsync_conf_full_path, "w")
+                f.write("<configuration></configuration>")
+                f.close()
+               os.chown(tagsync_conf_full_path,ownerId,groupId)
+               os.chmod(tagsync_conf_full_path,0750)
+       else:
+               if os.path.islink(tagsync_conf_full_path):
+                       os.remove(tagsync_conf_full_path)
+
        if isfile(hadoop_conf_full_path):
                os.symlink(hadoop_conf_full_path, tagsync_conf_full_path)
 

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/00c00253/unixauthservice/scripts/setup.py
----------------------------------------------------------------------
diff --git a/unixauthservice/scripts/setup.py b/unixauthservice/scripts/setup.py
index 1f46546..4b93a40 100755
--- a/unixauthservice/scripts/setup.py
+++ b/unixauthservice/scripts/setup.py
@@ -49,7 +49,7 @@ defaultCertFileName = 'unixauthservice.jks'
 outputFileName = 'ranger-ugsync-site.xml'
 installPropFileName = 'install.properties'
 defaultSiteXMLFileName = 'ranger-ugsync-default.xml'
-log4jFileName          = 'log4j.xml'
+log4jFileName          = 'log4j.properties'
 install2xmlMapFileName = 'installprop2xml.properties'
 templateFileName = 'ranger-ugsync-template.xml'
 initdProgramName = 'ranger-usersync'
@@ -323,17 +323,6 @@ def main():
        logFolderName = globalDict['logdir']
        hadoop_conf = globalDict['hadoop_conf']
 
-        hadoop_conf_full_path = os.path.join(hadoop_conf, hadoopConfFileName)
-       usersync_conf_full_path = 
os.path.join(usersyncBaseDirFullName,confBaseDirName,hadoopConfFileName)
-        if not isfile(hadoop_conf_full_path):
-                print "WARN: core-site.xml file not found in provided hadoop 
conf path..."
-                f = open(usersync_conf_full_path, "w")
-                f.write("<configuration></configuration>")
-                f.close()
-        else:
-                if os.path.islink(usersync_conf_full_path):
-                        os.remove(usersync_conf_full_path)
-
        if logFolderName.lower() == "$pwd" or logFolderName == "" :
                 logFolderName = os.path.join(os.getcwd(),"logs")
        ugsyncLogFolderName = logFolderName
@@ -424,14 +413,14 @@ def main():
                groupName = mergeProps[unixGroupProp]
 
        try:
-               ownerId = pwd.getpwnam(ownerName).pw_uid
+               groupId = grp.getgrnam(groupName).gr_gid
        except KeyError, e:
-               ownerId = createUser(ownerName, groupName)
+               groupId = createGroup(groupName)
 
        try:
-               groupId = grp.getgrnam(groupName).gr_gid
+               ownerId = pwd.getpwnam(ownerName).pw_uid
        except KeyError, e:
-               groupId = createGroup(groupId)
+               ownerId = createUser(ownerName, groupName)
 
        os.chown(logFolderName,ownerId,groupId)
        os.chown(ugsyncLogFolderName,ownerId,groupId)
@@ -507,6 +496,19 @@ def main():
         os.chown(os.path.join(confBaseDirName, 
ENV_HADOOP_CONF_FILE),ownerId,groupId)
         os.chmod(os.path.join(confBaseDirName, ENV_HADOOP_CONF_FILE),0755)
 
+        hadoop_conf_full_path = os.path.join(hadoop_conf, hadoopConfFileName)
+       usersync_conf_full_path = 
os.path.join(usersyncBaseDirFullName,confBaseDirName,hadoopConfFileName)
+        if not isfile(hadoop_conf_full_path):
+                print "WARN: core-site.xml file not found in provided hadoop 
conf path..."
+                f = open(usersync_conf_full_path, "w")
+                f.write("<configuration></configuration>")
+                f.close()
+               os.chown(usersync_conf_full_path,ownerId,groupId)
+               os.chmod(usersync_conf_full_path,0750)
+        else:
+                if os.path.islink(usersync_conf_full_path):
+                        os.remove(usersync_conf_full_path)
+
        if isfile(hadoop_conf_full_path):
                os.symlink(hadoop_conf_full_path, usersync_conf_full_path)
 

Reply via email to