SLIDER-5 CLI to list and retrieve service bindings & configs -requests for missing conf files are mapped to BadCommandArguments exception and exit code
git-svn-id: https://svn.apache.org/repos/asf/incubator/slider/trunk@1594905 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 526a40d..8c4a67c 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
@@ -1963,7 +1963,9 @@
actionRegistryGetConfig(registryArgs);
outputConfig(publishedConfiguration, registryArgs);
} catch (FileNotFoundException e) {
-// TODO
+ //there's no configuration here, so raise an error
+ throw new BadCommandArgumentsException(e, "Unknown configuration \"%s\"",
+ registryArgs.getConf);
}
} else {
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 e2c8e39..a114abf 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
@@ -28,6 +28,7 @@
import org.apache.slider.client.SliderClient
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.UnknownApplicationInstanceException
import org.apache.slider.core.main.ServiceLauncher
import org.apache.slider.core.persist.JsonSerDeser
@@ -325,8 +326,15 @@
assert new File(outputDir, yarn_site_config + ".xml").exists()
describe registryArgs.toString()
- registryArgs.getConf = "undefined-file"
- client.actionRegistry(registryArgs)
+
+ def unknownFilename = "undefined-file"
+ registryArgs.getConf = unknownFilename
+ try {
+ client.actionRegistry(registryArgs)
+ fail("attempt to retrieve the file $unknownFilename succeeded")
+ } catch (BadCommandArgumentsException expected) {
+ assert expected.toString().contains(unknownFilename)
+ }
describe "freeze cluster"
diff --git a/src/site/markdown/manpage.md b/src/site/markdown/manpage.md
index e71fe85..85eccee 100644
--- a/src/site/markdown/manpage.md
+++ b/src/site/markdown/manpage.md
@@ -345,7 +345,10 @@
### `registry (--list | --listconf | --getconf <conf>) [--name <name>] [--servicetype <servicetype>] [--verbose]`
-List registered application instances visible to the user.
+List registered application instances visible to the user. This is slightly
+different from the `slider list` command in that it does not make use of the
+YARN application list. Instead it communicates with Zookeeper -and works
+with any applications which has registered itself with the "service registry"
The `--name <name>` option names the registry entry to work with. For slider applications,
this is the application instance