You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/05/15 15:23:19 UTC

svn commit: r1594909 - in /incubator/slider/trunk/slider-core/src: main/java/org/apache/slider/client/SliderClient.java test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy

Author: stevel
Date: Thu May 15 13:23:18 2014
New Revision: 1594909

URL: http://svn.apache.org/r1594909
Log:
SLIDER-5 registry CLI adds int exit code and fails if there is no configs of the given scope (internal/external)

Modified:
    incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
    incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy

Modified: incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/client/SliderClient.java?rev=1594909&r1=1594908&r2=1594909&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/client/SliderClient.java (original)
+++ incubator/slider/trunk/slider-core/src/main/java/org/apache/slider/client/SliderClient.java Thu May 15 13:23:18 2014
@@ -246,7 +246,7 @@ public class SliderClient extends Abstra
         exitCode = actionList(clusterName);
         break;
       case ACTION_REGISTRY:
-        actionRegistry(
+        exitCode = actionRegistry(
             serviceArgs.getActionRegistryArgs());
         break;
       case ACTION_STATUS:
@@ -1941,11 +1941,13 @@ public class SliderClient extends Abstra
    * Registry operation
    *
    * @param registryArgs registry Arguments
+   * @return 0 for success, -1 for some issues that aren't errors, just failures
+   * to retrieve information (e.g. no configurations for that entry)
    * @throws YarnException YARN problems
    * @throws IOException Network or other problems
    */
   @VisibleForTesting
-  public void actionRegistry(ActionRegistryArgs registryArgs) throws
+  public int actionRegistry(ActionRegistryArgs registryArgs) throws
       YarnException,
       IOException {
     // as this is also a test entry point, validate
@@ -1955,7 +1957,11 @@ public class SliderClient extends Abstra
       actionRegistryList(registryArgs);
     } else if (registryArgs.listConf) {
       // list the configurations
-      actionRegistryListConfigs(registryArgs);
+      try {
+        actionRegistryListConfigs(registryArgs);
+      } catch (FileNotFoundException e) {
+        return EXIT_FALSE;
+      }
     } else if (SliderUtils.isSet(registryArgs.getConf)) {
       // get a configuration
       try {
@@ -1969,10 +1975,11 @@ public class SliderClient extends Abstra
       }
 
     } else {
-      // its an unknown command
+      // it's an unknown command
       throw new BadCommandArgumentsException(
           "Bad command arguments for "+ ACTION_REGISTRY +" " + registryArgs);
     }
+    return EXIT_SUCCESS;
   }
 
   /**

Modified: incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy
URL: http://svn.apache.org/viewvc/incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy?rev=1594909&r1=1594908&r2=1594909&view=diff
==============================================================================
--- incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy (original)
+++ incubator/slider/trunk/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy Thu May 15 13:23:18 2014
@@ -294,12 +294,7 @@ class TestStandaloneRegistryAM extends A
     registryArgs.listConf = true
     registryArgs.internal = true
     describe registryArgs.toString()
-    try {
-      client.actionRegistry(registryArgs)
-      fail("expected a failure")
-    } catch (FileNotFoundException expected) {
-      //expected
-    }
+    assert 0 != client.actionRegistry(registryArgs)
 
     registryArgs.list = false;
     registryArgs.listConf = false