hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lil...@apache.org
Subject incubator-hawq git commit: HAWQ-1415. Set the default_value of JAVA_HOME for running RPS (close #1197)
Date Tue, 28 Mar 2017 02:40:25 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 34cea88d1 -> a803aab4e


HAWQ-1415. Set the default_value of JAVA_HOME for running RPS
(close #1197)


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

Branch: refs/heads/master
Commit: a803aab4eec4a71e83d2bd18bb72b93ba4be31a2
Parents: 34cea88
Author: ljainpivotalio <ljain@pivotal.io>
Authored: Mon Mar 27 16:28:42 2017 -0700
Committer: Lili Ma <ictmalili@gmail.com>
Committed: Tue Mar 28 10:40:04 2017 +0800

----------------------------------------------------------------------
 ranger-plugin/conf/rps.properties             |  3 +++
 ranger-plugin/scripts/enable-ranger-plugin.sh | 21 ++++++++++++++++++++-
 ranger-plugin/scripts/rps.sh                  |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a803aab4/ranger-plugin/conf/rps.properties
----------------------------------------------------------------------
diff --git a/ranger-plugin/conf/rps.properties b/ranger-plugin/conf/rps.properties
index 81a6986..7565885 100644
--- a/ranger-plugin/conf/rps.properties
+++ b/ranger-plugin/conf/rps.properties
@@ -36,3 +36,6 @@ RPS_HEAP_SIZE=128m
 
 # use CATALINA_HOME in default and use /usr/lib/bigtop-tomcat if CATALINA_HOME not set
 CATALINA_HOME=${CATALINA_HOME:-/usr/lib/bigtop-tomcat}
+
+# use JAVA_HOME in default and use /usr/java/default if JAVA_HOME not set
+JAVA_HOME=${JAVA_HOME:-/usr/java/default}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a803aab4/ranger-plugin/scripts/enable-ranger-plugin.sh
----------------------------------------------------------------------
diff --git a/ranger-plugin/scripts/enable-ranger-plugin.sh b/ranger-plugin/scripts/enable-ranger-plugin.sh
index 05a0b1d..febaf81 100755
--- a/ranger-plugin/scripts/enable-ranger-plugin.sh
+++ b/ranger-plugin/scripts/enable-ranger-plugin.sh
@@ -150,7 +150,7 @@ function validate_params() {
   get_hawq_password
   echo "RANGER URL  = ${RANGER_URL}" 
   echo "RANGER User = ${RANGER_USER}" 
-  echo "RANGER Password = $(mask ${RANGER_PASSWORD})" 
+  echo "RANGER Password = $(mask ${RANGER_PASSWORD})"
   echo "HAWQ HOST = ${HAWQ_HOST}"
   echo "HAWQ PORT = ${HAWQ_PORT}"  
   echo "HAWQ User = ${HAWQ_USER}" 
@@ -211,6 +211,24 @@ function update_ranger_url() {
   echo "Updated POLICY_MGR_URL to ${policy_mgr_url} in ${prop_file}"
 }
 
+function update_java_home() {
+  local java_base="/usr/jdk64"
+  if [[ -d ${java_base} ]]; then
+    local DIR_NAME=$(ls ${java_base} | sort -r | head -1)
+
+    if [[ ${DIR_NAME} ]]; then
+      JAVA_HOME_DIR="${java_base}/${DIR_NAME}"
+      local prop_file=$(dirname ${SCRIPT_DIR})/etc/rps.properties
+      sed -i -e "s|/usr/java/default|${JAVA_HOME_DIR}|g" ${prop_file}
+      echo "Updated default value of JAVA_HOME to ${JAVA_HOME_DIR} in ${prop_file}"
+    fi
+  fi
+
+  if [[ ! ${JAVA_HOME_DIR} && ! ${JAVA_HOME} ]]; then
+    echo "Unable to locate JAVA_HOME on this machine. Please modify the default value of
JAVA_HOME in ${prop_file}."
+  fi
+}
+
 main() {
   if [[ $# -lt 1 ]]; then
     usage
@@ -221,5 +239,6 @@ main() {
   create_hawq_service_definition
   create_hawq_service_instance
   update_ranger_url
+  update_java_home
 }
 main "$@"

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/a803aab4/ranger-plugin/scripts/rps.sh
----------------------------------------------------------------------
diff --git a/ranger-plugin/scripts/rps.sh b/ranger-plugin/scripts/rps.sh
index fa268c9..70aa547 100755
--- a/ranger-plugin/scripts/rps.sh
+++ b/ranger-plugin/scripts/rps.sh
@@ -32,6 +32,7 @@ BASEDIR=$( dirname ${CWDIR} )
 # read properties from the file
 source ${BASEDIR}/etc/rps.properties
 
+export JAVA_HOME
 export CATALINA_HOME
 export CATALINA_BASE=${BASEDIR}/plugin-service
 export CATALINA_PID=${CATALINA_BASE}/work/rps.pid


Mime
View raw message