ATLAS-2732: updated import-hive.sh/import-hbase.sh to handle kerberos security command-line arguments
Signed-off-by: Madhan Neethiraj <mad...@apache.org> (cherry picked from commit f93da20b3fc8a4853c4c7d991cac375cb3a6ad6a) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/32a87a31 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/32a87a31 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/32a87a31 Branch: refs/heads/branch-1.0 Commit: 32a87a3140d9af3b82906a0192265632966a6eab Parents: 1e4b743 Author: rmani <rm...@hortonworks.com> Authored: Sat Jun 2 13:48:59 2018 -0700 Committer: Madhan Neethiraj <mad...@apache.org> Committed: Tue Jun 5 07:53:03 2018 -0700 ---------------------------------------------------------------------- addons/hbase-bridge/src/bin/import-hbase.sh | 26 +++++++++++++++++------ addons/hive-bridge/src/bin/import-hive.sh | 27 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/32a87a31/addons/hbase-bridge/src/bin/import-hbase.sh ---------------------------------------------------------------------- diff --git a/addons/hbase-bridge/src/bin/import-hbase.sh b/addons/hbase-bridge/src/bin/import-hbase.sh index 0a5989f..d429ea2 100644 --- a/addons/hbase-bridge/src/bin/import-hbase.sh +++ b/addons/hbase-bridge/src/bin/import-hbase.sh @@ -35,8 +35,6 @@ BASEDIR=`cd ${BASEDIR}/..;pwd` echo ">>>>> $BASEDIR" -allargs=$@ - if test -z "${JAVA_HOME}" then JAVA_BIN=`which java` @@ -125,16 +123,32 @@ fi JAVA_PROPERTIES="$ATLAS_OPTS -Datlas.log.dir=$ATLAS_LOG_DIR -Datlas.log.file=import-hbase.log -Dlog4j.configuration=atlas-hbase-import-log4j.xml" -shift -while [[ ${1} =~ ^\-D ]]; do - JAVA_PROPERTIES="${JAVA_PROPERTIES} ${1}" +IMPORT_ARGS= +JVM_ARGS= + +while true +do + option=$1 shift + + case "$option" in + -n) IMPORT_ARGS="$IMPORT_ARGS -n $1"; shift;; + -t) IMPORT_ARGS="$IMPORT_ARGS -t $1"; shift;; + -f) IMPORT_ARGS="$IMPORT_ARGS -f $1"; shift;; + --namespace) IMPORT_ARGS="$IMPORT_ARGS --namespace $1"; shift;; + --table) IMPORT_ARGS="$IMPORT_ARGS --table $1"; shift;; + --filename) IMPORT_ARGS="$IMPORT_ARGS --filename $1"; shift;; + "") break;; + *) JVM_ARGS="$JVM_ARGS $option" + esac done +JAVA_PROPERTIES="${JAVA_PROPERTIES} ${JVM_ARGS}" + echo "Log file for import is $LOGFILE" -"${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hbase.bridge.HBaseBridge $allargs +"${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hbase.bridge.HBaseBridge $IMPORT_ARGS RETVAL=$? [ $RETVAL -eq 0 ] && echo HBase Data Model imported successfully!!! http://git-wip-us.apache.org/repos/asf/atlas/blob/32a87a31/addons/hive-bridge/src/bin/import-hive.sh ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/bin/import-hive.sh b/addons/hive-bridge/src/bin/import-hive.sh index 98f4c84..49e6d70 100755 --- a/addons/hive-bridge/src/bin/import-hive.sh +++ b/addons/hive-bridge/src/bin/import-hive.sh @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. See accompanying LICENSE file. # - # resolve links - $0 may be a softlink PRG="${0}" @@ -31,8 +30,6 @@ done BASEDIR=`dirname ${PRG}` BASEDIR=`cd ${BASEDIR}/..;pwd` -allargs=$@ - if test -z "${JAVA_HOME}" then JAVA_BIN=`which java` @@ -121,16 +118,32 @@ fi JAVA_PROPERTIES="$ATLAS_OPTS -Datlas.log.dir=$ATLAS_LOG_DIR -Datlas.log.file=import-hive.log -Dlog4j.configuration=atlas-hive-import-log4j.xml" -shift -while [[ ${1} =~ ^\-D ]]; do - JAVA_PROPERTIES="${JAVA_PROPERTIES} ${1}" +IMPORT_ARGS= +JVM_ARGS= + +while true +do + option=$1 shift + + case "$option" in + -d) IMPORT_ARGS="$IMPORT_ARGS -d $1"; shift;; + -t) IMPORT_ARGS="$IMPORT_ARGS -t $1"; shift;; + -f) IMPORT_ARGS="$IMPORT_ARGS -f $1"; shift;; + --database) IMPORT_ARGS="$IMPORT_ARGS --database $1"; shift;; + --table) IMPORT_ARGS="$IMPORT_ARGS --table $1"; shift;; + --filename) IMPORT_ARGS="$IMPORT_ARGS --filename $1"; shift;; + "") break;; + *) JVM_ARGS="$JVM_ARGS $option" + esac done +JAVA_PROPERTIES="${JAVA_PROPERTIES} ${JVM_ARGS}" + echo "Log file for import is $LOGFILE" -"${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hive.bridge.HiveMetaStoreBridge $allargs +"${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hive.bridge.HiveMetaStoreBridge $IMPORT_ARGS RETVAL=$? [ $RETVAL -eq 0 ] && echo Hive Meta Data imported successfully!!!