hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esp...@apache.org
Subject incubator-hawq git commit: HAWQ-1415. Set the default_value of JAVA_HOME for running RPS (closes #1206).
Date Wed, 29 Mar 2017 03:06:52 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master fe6c0e9c8 -> dc41e4c51


HAWQ-1415. Set the default_value of JAVA_HOME for running RPS (closes #1206).


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

Branch: refs/heads/master
Commit: dc41e4c5131351a5260788e14f6cebd611e4762a
Parents: fe6c0e9
Author: ljainpivotalio <ljain@pivotal.io>
Authored: Tue Mar 28 19:05:52 2017 -0700
Committer: Ed Espino <eespino@pivotal.io>
Committed: Tue Mar 28 20:03:41 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dc41e4c5/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/dc41e4c5/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..2fa7162 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,28 @@ function update_ranger_url() {
   echo "Updated POLICY_MGR_URL to ${policy_mgr_url} in ${prop_file}"
 }
 
+function update_java_home() {
+  local jdk64="/usr/jdk64"
+  local java_sdk="/etc/alternatives/java_sdk"
+
+  if [[ -d ${jdk64} ]]; then
+    local DIR_NAME=$(ls ${jdk64} | sort -r | head -1)
+    if [[ ${DIR_NAME} ]]; then
+      JAVA_HOME_DIR="${jdk64}/${DIR_NAME}"
+    fi
+  elif [[ -d ${java_sdk} ]]; then
+    JAVA_HOME_DIR="${java_sdk}"
+  fi
+
+  if [[ ${JAVA_HOME_DIR} ]]; then
+    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}"
+  elif [[ ! ${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 +243,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/dc41e4c5/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