Skip to content

Commit

Permalink
RANGER-4438: fixed setup scripts to not require java_opts in install.…
Browse files Browse the repository at this point in the history
…properties
  • Loading branch information
mneethiraj committed Nov 27, 2023
1 parent 1d5ac09 commit 6c26045
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion kms/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ get_prop(){
echo $value
}

get_prop_or_default() {
validateProperty=$(sed '/^\#/d' $2 | grep "^$1\s*=" | tail -n 1) # for validation

if test -z "$validateProperty" ;
then
value=$3 # default value
else
value=$(echo $validateProperty | cut -d "=" -f2-)
fi

echo $value
}

PYTHON_COMMAND_INVOKER=$(get_prop 'PYTHON_COMMAND_INVOKER' $PROPFILE)
DB_FLAVOR=$(get_prop 'DB_FLAVOR' $PROPFILE)
SQL_CONNECTOR_JAR=$(get_prop 'SQL_CONNECTOR_JAR' $PROPFILE)
Expand Down Expand Up @@ -80,7 +93,7 @@ LOGFILE=$(eval echo "$(get_prop 'LOGFILE' $PROPFILE)")
JAVA_BIN=$(get_prop 'JAVA_BIN' $PROPFILE)
JAVA_VERSION_REQUIRED=$(get_prop 'JAVA_VERSION_REQUIRED' $PROPFILE)
JAVA_ORACLE=$(get_prop 'JAVA_ORACLE' $PROPFILE)
java_opts=$(get_prop 'java_opts' $PROPFILE)
java_opts=$(get_prop_or_default 'java_opts' $PROPFILE '')
mysql_core_file=$(get_prop 'mysql_core_file' $PROPFILE)
oracle_core_file=$(get_prop 'oracle_core_file' $PROPFILE)
postgres_core_file=$(get_prop 'postgres_core_file' $PROPFILE)
Expand Down
15 changes: 14 additions & 1 deletion security-admin/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ get_prop(){
fi
}

get_prop_or_default() {
validateProperty=$(sed '/^\#/d' $2 | grep "^$1\s*=" | tail -n 1) # for validation

if test -z "$validateProperty" ;
then
value=$3 # default value
else
value=$(echo $validateProperty | cut -d "=" -f2-)
fi

echo $value
}

PROPFILE=${RANGER_ADMIN_CONF:-$PWD}/install.properties
if [ ! -f "${PROPFILE}" ]; then
echo "$PROPFILE file not found....!!"
Expand Down Expand Up @@ -129,7 +142,7 @@ LOGFILES=$(eval echo "$(get_prop 'LOGFILES' $PROPFILE)")
JAVA_BIN=$(get_prop 'JAVA_BIN' $PROPFILE)
JAVA_VERSION_REQUIRED=$(get_prop 'JAVA_VERSION_REQUIRED' $PROPFILE)
JAVA_ORACLE=$(get_prop 'JAVA_ORACLE' $PROPFILE)
java_opts=$(get_prop 'java_opts' $PROPFILE)
java_opts=$(get_prop_or_default 'java_opts' $PROPFILE '')
mysql_core_file=$(get_prop 'mysql_core_file' $PROPFILE)
mysql_audit_file=$(get_prop 'mysql_audit_file' $PROPFILE)
oracle_core_file=$(get_prop 'oracle_core_file' $PROPFILE)
Expand Down

0 comments on commit 6c26045

Please sign in to comment.