ATLAS-4421: [Atlas: Hive Import] When import-hive is run with incorrect input the information is not conveyed to the user

Signed-off-by: Sarath Subramanian <sarath@apache.org>
diff --git a/addons/hive-bridge/src/bin/import-hive.sh b/addons/hive-bridge/src/bin/import-hive.sh
index fde486f..c353937 100755
--- a/addons/hive-bridge/src/bin/import-hive.sh
+++ b/addons/hive-bridge/src/bin/import-hive.sh
@@ -156,8 +156,8 @@
 "${JAVA_BIN}" ${JAVA_PROPERTIES} -cp "${CP}" org.apache.atlas.hive.bridge.HiveMetaStoreBridge $IMPORT_ARGS
 
 RETVAL=$?
-[ $RETVAL -eq 0 ] && echo Hive Meta Data imported successfully!!!
-[ $RETVAL -ne 0 ] && echo Failed to import Hive Meta Data!!!
+[ $RETVAL -eq 0 ] && echo Hive metadata imported successfully!
+[ $RETVAL -ne 0 ] && echo Failed to import Hive metadata! Check logs at: $LOGFILE for details.
 
 exit $RETVAL
 
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
index 08471b4..c361ac6 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
@@ -161,6 +161,7 @@
 
             if (deleteNonExisting) {
                 hiveMetaStoreBridge.deleteEntitiesForNonExistingHiveMetadata(failOnError);
+                exitCode = EXIT_CODE_SUCCESS;
             } else if (StringUtils.isNotEmpty(fileToImport)) {
                 File f = new File(fileToImport);
 
@@ -187,12 +188,13 @@
                     exitCode = EXIT_CODE_SUCCESS;
                 } else {
                     LOG.error("Failed to read the input file: " + fileToImport);
+                    exitCode = EXIT_CODE_FAILED;
                 }
             } else {
                 hiveMetaStoreBridge.importHiveMetadata(databaseToImport, tableToImport, failOnError);
+                exitCode = EXIT_CODE_SUCCESS;
             }
 
-            exitCode = EXIT_CODE_SUCCESS;
         } catch(ParseException e) {
             LOG.error("Failed to parse arguments. Error: ", e.getMessage());
             printUsage();
@@ -326,7 +328,8 @@
                 }
             }
         } else {
-            LOG.info("No database found");
+            LOG.error("No database found");
+            System.exit(EXIT_CODE_FAILED);
         }
     }
 
@@ -365,7 +368,7 @@
                 }
             }
         } else {
-            LOG.info("No tables to import in database {}", databaseName);
+            LOG.error("No tables to import in database {}", databaseName);
         }
 
         return tablesImported;