You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2018/06/05 14:54:56 UTC

atlas git commit: ATLAS-2732: updated import-hive.sh/import-hbase.sh to handle kerberos security command-line arguments

Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 84fddc1e5 -> 61e03d407


ATLAS-2732: updated import-hive.sh/import-hbase.sh to handle kerberos security command-line arguments

Signed-off-by: Madhan Neethiraj <ma...@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/61e03d40
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/61e03d40
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/61e03d40

Branch: refs/heads/branch-0.8
Commit: 61e03d4075cc98fe94ed82b7bf7cc14924062bcf
Parents: 84fddc1
Author: rmani <rm...@hortonworks.com>
Authored: Sat Jun 2 13:48:59 2018 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Tue Jun 5 07:54:24 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/61e03d40/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/61e03d40/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!!!