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 2023/04/02 15:37:51 UTC

[ranger] 02/02: RANGER-4124: value of -Dlogback.configurationFile in ranger-tagsync-services.sh is not configurable

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

madhan pushed a commit to branch ranger-2.4
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit 9ee4b02ccf2a96ec4a7981b01c0c4e5c9d311a3b
Author: Yao Lei <le...@163.com>
AuthorDate: Wed Mar 8 10:53:18 2023 +0800

    RANGER-4124: value of -Dlogback.configurationFile in ranger-tagsync-services.sh is not configurable
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit cdc873177c4a0289826eff0b74df72d0d04b6d27)
---
 tagsync/scripts/ranger-tagsync-services.sh | 6 +++++-
 tagsync/scripts/setup.py                   | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tagsync/scripts/ranger-tagsync-services.sh b/tagsync/scripts/ranger-tagsync-services.sh
index 46f4428e3..460c4a130 100755
--- a/tagsync/scripts/ranger-tagsync-services.sh
+++ b/tagsync/scripts/ranger-tagsync-services.sh
@@ -92,8 +92,12 @@ if [ "${action}" == "START" ]; then
 
 	cd ${cdir}
 
+	if [ -z "${TAGSYNC_CONF_DIR}" ]; then
+	    TAGSYNC_CONF_DIR=${cdir}/conf
+	fi
+
 	SLEEP_TIME_AFTER_START=5
-	nohup java -Dproc_rangertagsync ${JAVA_OPTS} -Dlogdir="${RANGER_TAGSYNC_LOG_DIR}" -Dlogback.configurationFile=file:/etc/ranger/tagsync/conf/logback.xml -cp "${cp}" org.apache.ranger.tagsync.process.TagSynchronizer  > ${RANGER_TAGSYNC_LOG_DIR}/tagsync.out 2>&1 &
+	nohup java -Dproc_rangertagsync ${JAVA_OPTS} -Dlogdir="${RANGER_TAGSYNC_LOG_DIR}" -Dlogback.configurationFile=file:${TAGSYNC_CONF_DIR}/logback.xml -cp "${cp}" org.apache.ranger.tagsync.process.TagSynchronizer  > ${RANGER_TAGSYNC_LOG_DIR}/tagsync.out 2>&1 &
 	VALUE_OF_PID=$!
 	echo "Starting Apache Ranger Tagsync Service"
 	sleep $SLEEP_TIME_AFTER_START
diff --git a/tagsync/scripts/setup.py b/tagsync/scripts/setup.py
index 6ac30565f..fb6d69c33 100755
--- a/tagsync/scripts/setup.py
+++ b/tagsync/scripts/setup.py
@@ -101,6 +101,7 @@ TAG_SOURCE_FILE_ENABLED = 'ranger.tagsync.source.file'
 hadoopConfFileName = 'core-site.xml'
 ENV_HADOOP_CONF_FILE = "ranger-tagsync-env-hadoopconfdir.sh"
 ENV_PID_FILE = 'ranger-tagsync-env-piddir.sh'
+ENV_CONF_FILE = 'ranger-tagsync-env-confdir.sh'
 
 globalDict = {}
 configure_security = False
@@ -488,10 +489,13 @@ def main():
 
 	write_env_files("RANGER_TAGSYNC_HADOOP_CONF_DIR", hadoop_conf, ENV_HADOOP_CONF_FILE)
 	write_env_files("TAGSYNC_PID_DIR_PATH", pid_dir_path, ENV_PID_FILE);
+	write_env_files("TAGSYNC_CONF_DIR", os.path.join(tagsyncBaseDirFullName,confBaseDirName), ENV_CONF_FILE)
 	os.chown(os.path.join(confBaseDirName, ENV_HADOOP_CONF_FILE),ownerId,groupId)
 	os.chmod(os.path.join(confBaseDirName, ENV_HADOOP_CONF_FILE),0o755)
 	os.chown(os.path.join(confBaseDirName, ENV_PID_FILE),ownerId,groupId)
 	os.chmod(os.path.join(confBaseDirName, ENV_PID_FILE),0o755)
+	os.chown(os.path.join(confBaseDirName, ENV_CONF_FILE),ownerId,groupId)
+	os.chmod(os.path.join(confBaseDirName, ENV_CONF_FILE),0o755)
 
 	f = open(os.path.join(confBaseDirName, ENV_PID_FILE), "a+")
 	f.write("\nexport {0}={1}".format("UNIX_TAGSYNC_USER",unix_user))