You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by na...@apache.org on 2018/03/19 19:09:14 UTC

[03/15] incubator-spot git commit: Add argument parser and handle new arguments

Add argument parser and handle new arguments

- Pulled most of these changes from SPOT-213
- Also moved the format argument to be captured within the "-f" flag
- Format checking is then performed after we've parsed all of the input arguments.


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

Branch: refs/heads/SPOT-181_ODM
Commit: 17f395973c3554ebbe5023b4e455be28c8dbca25
Parents: 7f96905
Author: Tadd Wood <ta...@arcadiadata.com>
Authored: Mon Feb 12 10:15:51 2018 -0800
Committer: Tadd Wood <ta...@arcadiadata.com>
Committed: Mon Feb 12 10:48:33 2018 -0800

----------------------------------------------------------------------
 spot-setup/odm/odm_setup.sh | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/17f39597/spot-setup/odm/odm_setup.sh
----------------------------------------------------------------------
diff --git a/spot-setup/odm/odm_setup.sh b/spot-setup/odm/odm_setup.sh
index 9c8eb9d..f23d2e3 100755
--- a/spot-setup/odm/odm_setup.sh
+++ b/spot-setup/odm/odm_setup.sh
@@ -46,13 +46,6 @@ function safe_mkdir() {
     fi
 }
 
-# Check the format argument and make sure its supported
-format=$1
-if [ "$format" != "pqt" ] && [ "$format" != "avro" ] ; then
-    echo "Format argument '$format' is not supported. Only Parquet and Avro are supported data storage formats. Use 'pqt' or 'avro'  instead (i.e. ./odm_setup pqt)."
-    exit 0
-fi
-
 SPOTCONF="/etc/spot.conf"
 DSOURCES=('odm')
 DFOLDERS=(
@@ -64,6 +57,34 @@ DFOLDERS=(
 'vulnerability_context'
 )
 
+# Check input argument options
+for arg in "$@"; do
+    case $arg in
+        "--no-sudo")
+            log "not using sudo"
+            no_sudo=true
+            shift
+            ;;
+        "-c")
+            shift
+            SPOTCONF=$1
+            log "Spot Configuration file: ${SPOTCONF}"
+            shift
+            ;;
+        "-f")
+            shift
+            format=$1
+            shift
+            ;;
+    esac
+done
+
+# Check the format argument and make sure its supported
+if [ "$format" != "pqt" ] && [ "$format" != "avro" ] ; then
+    log "Format argument '$format' is not supported. Only Parquet and Avro are supported data storage formats. Use 'pqt' or 'avro'  instead (i.e. ./odm_setup pqt)."
+    exit 1
+fi
+
 # Sourcing ODM Spot configuration variables
 source /etc/spot.conf