You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by to...@apache.org on 2011/04/14 18:27:43 UTC
svn commit: r1092389 - in /incubator/whirr/trunk: CHANGES.txt
cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java
Author: tomwhite
Date: Thu Apr 14 16:27:43 2011
New Revision: 1092389
URL: http://svn.apache.org/viewvc?rev=1092389&view=rev
Log:
WHIRR-172. Log warning for unrecognized service names.
Modified:
incubator/whirr/trunk/CHANGES.txt
incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java
Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1092389&r1=1092388&r2=1092389&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Thu Apr 14 16:27:43 2011
@@ -44,6 +44,8 @@ Trunk (unreleased changes)
WHIRR-274. Add wagon-ssh-external as a maven build extension. (asavu)
+ WHIRR-172. Log warning for unrecognized service names. (tomwhite)
+
Release 0.4.0 - 2011-03-15
NEW FEATURES
Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java?rev=1092389&r1=1092388&r2=1092389&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java Thu Apr 14 16:27:43 2011
@@ -39,12 +39,18 @@ import org.apache.whirr.ClusterControlle
import org.apache.whirr.ClusterControllerFactory;
import org.apache.whirr.ClusterSpec;
import org.apache.whirr.ClusterSpec.Property;
+import org.apache.whirr.actions.BootstrapClusterAction;
import org.apache.whirr.cli.Command;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An abstract command for interacting with clusters.
*/
public abstract class AbstractClusterSpecCommand extends Command {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(AbstractClusterSpecCommand.class);
protected ClusterControllerFactory factory;
@@ -105,13 +111,12 @@ public abstract class AbstractClusterSpe
/**
* Create the specified service
- * @throws IllegalArgumentException if serviceName is not found
*/
protected ClusterController createClusterController(String serviceName) {
ClusterController controller = factory.create(serviceName);
if (controller == null) {
- throw new IllegalArgumentException("Unable to find service "
- + serviceName + ", exiting");
+ LOG.warn("Unable to find service {}, using default.", serviceName);
+ controller = factory.create(null);
}
return controller;
}
Modified: incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java?rev=1092389&r1=1092388&r2=1092389&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java (original)
+++ incubator/whirr/trunk/cli/src/test/java/org/apache/whirr/cli/command/AbstractClusterSpecCommandTest.java Thu Apr 14 16:27:43 2011
@@ -59,9 +59,9 @@ public class AbstractClusterSpecCommandT
}
/**
- * Ensure that an invalid service name causes failure
+ * Ensure that an invalid service name uses the default (after logging a
+ * warning).
*/
- @Test(expected=IllegalArgumentException.class)
public void testCreateServerWithInvalidClusterControllerName() throws Exception {
AbstractClusterSpecCommand clusterSpecCommand = new AbstractClusterSpecCommand("name",
"description", new ClusterControllerFactory()) {
@@ -79,7 +79,7 @@ public class AbstractClusterSpecCommandT
"--private-key-file", keys.get("private").getAbsolutePath()
);
ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
- // this should fail - non-existent service
+ // following should not fail
clusterSpecCommand.createClusterController("bar");
}
}