Repository: knox
Updated Branches:
  refs/heads/master edf54197e -> 3f8ff2aaf


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/3f8ff2aa
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/3f8ff2aa
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/3f8ff2aa

Branch: refs/heads/master
Commit: 3f8ff2aafe442f654bbab46b2b6dfadd9a054096
Parents: edf5419
Author: Larry McCay <lmc...@hortonworks.com>
Authored: Sat Feb 11 09:54:34 2017 -0500
Committer: Larry McCay <lmc...@hortonworks.com>
Committed: Sat Feb 11 09:54:34 2017 -0500

----------------------------------------------------------------------
 gateway-shell-release/home/bin/knoxshell.sh | 31 ++++++++++++++----------
 1 file changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/3f8ff2aa/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 af0e998..a7031f3 100755
--- a/gateway-shell-release/home/bin/knoxshell.sh
+++ b/gateway-shell-release/home/bin/knoxshell.sh
@@ -59,13 +59,18 @@ function main {
    #printf "$@"
    case "$1" in
       init)
-        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh init 
--gateway $@ || exit 1
+        if [ "$#" -ne 2 ]; then
+            echo "Illegal number of parameters."
+            printHelp
+        else
+          $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh init 
--gateway $2 || exit 1
+        fi
          ;;
       list)
-        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh list $@ || 
exit 1
+        $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
+        $JAVA -cp $APP_JAR org.apache.hadoop.gateway.shell.KnoxSh destroy || 
exit 1
          ;;
       help)
          printHelp
@@ -86,16 +91,16 @@ function printHelp {
    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 "   knoxshell.sh [[init <topology-url>|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
 }

Reply via email to