You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2017/02/11 00:30:38 UTC

knox git commit: KNOX-881 - Add KnoxSh init, list and destroy to knoxshell.sh

Repository: knox
Updated Branches:
  refs/heads/master 761dd5d44 -> edf54197e


KNOX-881 - Add KnoxSh init, list and destroy to knoxshell.sh

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/edf54197
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/edf54197
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/edf54197

Branch: refs/heads/master
Commit: edf54197e0a57611dd2f58ed4597cf94c2ccbceb
Parents: 761dd5d
Author: Larry McCay <lm...@hortonworks.com>
Authored: Fri Feb 10 19:30:17 2017 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Fri Feb 10 19:30:17 2017 -0500

----------------------------------------------------------------------
 gateway-shell-release/home/bin/knoxshell.sh | 38 ++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/edf54197/gateway-shell-release/home/bin/knoxshell.sh
----------------------------------------------------------------------
diff --git a/gateway-shell-release/home/bin/knoxshell.sh b/gateway-shell-release/home/bin/knoxshell.sh
index 05015e5..af0e998 100755
--- a/gateway-shell-release/home/bin/knoxshell.sh
+++ b/gateway-shell-release/home/bin/knoxshell.sh
@@ -57,14 +57,46 @@ APP_ERR_FILE="$APP_LOG_DIR/$APP_NAME.err"
 function main {
    #printf "Starting $APP_LABEL \n"
    #printf "$@"
+   case "$1" in
+      init)
+        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh init --gateway $@ || exit 1
+         ;;
+      list)
+        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh list $@ || exit 1
+         ;;
+      destroy)
+        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh destroy $@ || exit 1
+         ;;
+      help)
+         printHelp
+         ;;
+      *)
+          $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR $@ || exit 1
+         ;;
+   esac
    
-   $JAVA $APP_MEM_OPTS $APP_DBG_OPTS $APP_LOG_OPTS -jar $APP_JAR $@ || exit 1
-
    return 0
 }
 
 function printHelp {
-   $JAVA -jar $APP_JAR -help
+   echo ""
+   echo "Apache Knox Client Shell"
+   echo "The client shell facility provide a CLI for establishing and managing Apache Knox Sessions"
+   echo "and executing the Apache Knox groovy-based DSL scripts. It may also be used to enter an"
+   echo "interactive shell where groovy-based DSL and groovy code may be entered and executed in realtime."
+   echo ""
+   echo "knoxshell usage: "
+   echo "       knoxshell.sh [[init|list|destroy|help] | [<script-file-name>]]"
+   echo "       ----------------------------------------------------------"
+   echo "       init <knox-gateway-url> - requests a session from the knox token service at the url"
+   echo "            example: knoxshell.sh init https://localhost:8443/gateway/sandbox"
+   echo "       list - lists the details of the cached knox session token"
+   echo "            example: knoxshell.sh list"
+   echo "       destroy - removes the cached knox session token"
+   echo "            example: knoxshell.sh destroy"
+   echo "       <script-file-name> - executes the groovy script file"
+   echo "            example: knoxshell.sh ~/bin/ls.groovy"
+   echo ""
    return 0
 }