SLIDER-63 registry CLI to return new NOT_FOUND exit code if there was no registry entry

git-svn-id: https://svn.apache.org/repos/asf/incubator/slider/trunk@1594949 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 0e01941..1b71234 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -1960,7 +1960,7 @@
       try {
         actionRegistryListConfigs(registryArgs);
       } catch (FileNotFoundException e) {
-        return EXIT_FALSE;
+        return EXIT_NOT_FOUND;
       }
     } else if (SliderUtils.isSet(registryArgs.getConf)) {
       // get a configuration
@@ -1970,10 +1970,10 @@
         outputConfig(publishedConfiguration, registryArgs);
       } catch (FileNotFoundException e) {
         //there's no configuration here, so raise an error
-        throw new BadCommandArgumentsException(e, "Unknown configuration \"%s\"",
+        throw new SliderException(EXIT_NOT_FOUND,  e,
+            "Unknown configuration \"%s\"",
             registryArgs.getConf);
       }
-
     } else {
       // it's an unknown command
       throw new BadCommandArgumentsException(
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java b/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
index 17e2e48..79b77dc 100644
--- a/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
+++ b/slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java
@@ -90,4 +90,8 @@
    */
   int EXIT_INSTANCE_EXISTS = 75;
 
+  /**
+   * The resource was not found
+   */
+  int EXIT_NOT_FOUND = 77;
 }
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy
index 73ffb86..2897c9c 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneRegistryAM.groovy
@@ -26,9 +26,10 @@
 import org.apache.slider.agent.AgentMiniClusterTestBase
 import org.apache.slider.api.ClusterNode
 import org.apache.slider.client.SliderClient
+import org.apache.slider.common.SliderExitCodes
 import org.apache.slider.common.SliderKeys
 import org.apache.slider.common.params.ActionRegistryArgs
-import org.apache.slider.core.exceptions.BadCommandArgumentsException
+import org.apache.slider.core.exceptions.SliderException
 import org.apache.slider.core.exceptions.UnknownApplicationInstanceException
 import org.apache.slider.core.main.ServiceLauncher
 import org.apache.slider.core.persist.JsonSerDeser
@@ -294,7 +295,7 @@
     registryArgs.listConf = true
     registryArgs.internal = true
     describe registryArgs.toString()
-    assert 0 != client.actionRegistry(registryArgs)
+    assert SliderExitCodes.EXIT_NOT_FOUND == client.actionRegistry(registryArgs)
 
     registryArgs.list = false;
     registryArgs.listConf = false
@@ -327,8 +328,9 @@
     try {
       client.actionRegistry(registryArgs)
       fail("attempt to retrieve the file $unknownFilename succeeded")
-    } catch (BadCommandArgumentsException expected) {
-      assert expected.toString().contains(unknownFilename)
+    } catch (SliderException expected) {
+      assertExceptionDetails(expected, SliderExitCodes.EXIT_NOT_FOUND,
+          unknownFilename)
     }
 
 
diff --git a/src/site/markdown/exitcodes.md b/src/site/markdown/exitcodes.md
index 05a369a..3a78920 100644
--- a/src/site/markdown/exitcodes.md
+++ b/src/site/markdown/exitcodes.md
@@ -145,7 +145,12 @@
      * when an attempt is made to create a new instance
      */
     int EXIT_INSTANCE_EXISTS = 75;
-
+    
+    /**
+     * The resource was not found
+     */
+    int EXIT_NOT_FOUND = 77;
+    
 ## Other exit codes
 
 YARN itself can fail containers, here are some of the causes we've seen
diff --git a/src/site/markdown/manpage.md b/src/site/markdown/manpage.md
index 85eccee..228a020 100644
--- a/src/site/markdown/manpage.md
+++ b/src/site/markdown/manpage.md
@@ -363,15 +363,20 @@
 are from the "internal" list of configuration data provided for use within a
 deployed application. 
 
+There are two common exit codes, the exact values being documented
+in [Exit Codes](exitcodes.md)
+
+1. If there is no matching service then the operation fails with the
+`EXIT_UNKNOWN_INSTANCE` code (70).
+2. If there are no configurations in a listing, or the named configuration
+is not found, the command returns the exit code `EXIT_NOT_FOUND` (77)
+
 Operations:
 
 #### `registry --list  [--servicetype <servicetype>] [--name <name>] [--verbose]`
 
 List all services of the service type and optionally the name. 
  
-If there were no matches then the operation fails with the `EXIT_UNKNOWN_INSTANCE` code
-
- 
  
  
 #### `registry --listconf [--name <name>]  [--internal] [--servicetype <servicetype>]`