This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 7cfef39  RANGER-2671: unlink core-site.xml in usersync conf before 
chown and chmod
7cfef39 is described below

commit 7cfef395c5c1cd8d0cdbf135d0360daff49e8d4c
Author: joey.ljy <[email protected]>
AuthorDate: Tue Dec 10 12:04:59 2019 +0800

    RANGER-2671: unlink core-site.xml in usersync conf before chown and chmod
    
    Signed-off-by: Pradeep <[email protected]>
---
 unixauthservice/scripts/setup.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/unixauthservice/scripts/setup.py b/unixauthservice/scripts/setup.py
index 54297f4..1dc1847 100755
--- a/unixauthservice/scripts/setup.py
+++ b/unixauthservice/scripts/setup.py
@@ -533,6 +533,19 @@ def main():
     os.chown(ugsyncCryptPath, ownerId, groupId)
 
     writeXMLUsingProperties(fn, mergeProps, outfn)
+    
+    hadoop_conf_full_path = join(hadoop_conf, hadoopConfFileName)
+    usersync_conf_full_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)
 
     fixPermList = [".", usersyncBaseDirFullName, confFolderName, 
certFolderName]
 
@@ -580,19 +593,6 @@ def main():
     f.write("\nexport {0}={1}".format("UNIX_USERSYNC_USER", unix_user))
     f.close()
 
-    hadoop_conf_full_path = join(hadoop_conf, hadoopConfFileName)
-    usersync_conf_full_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) and not isfile(usersync_conf_full_path):
         os.symlink(hadoop_conf_full_path, usersync_conf_full_path)
 

Reply via email to