Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WHIRR-556: Improve 'Running on $PROVIDER using identity $IDENTITY' me…

…ssage

git-svn-id: https://svn.apache.org/repos/asf/whirr/trunk@1302828 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 6457e311e572e0797d1b67360baad2feae13e6b0 1 parent a340fde
Karel Vervaeke authored
2  CHANGES.txt
View
@@ -13,6 +13,8 @@ Trunk (unreleased changes)
IMPROVEMENTS
+ WHIRR-556. Improve the 'Running on $PROVIDER using $IDENTITY' message (kve)
+
WHIRR-514. Avoid hardcoded Whirr version number in karaf tests (kve)
(orig: Update release instructions or fix update-version script?)
2  bin/whirr
View
@@ -66,8 +66,6 @@ if $cygwin; then
CLASSPATH=`cygpath -wp $CLASSPATH`;
fi
-echo Running on "$WHIRR_PROVIDER" using identity "$WHIRR_IDENTITY"
-
# Start the application
java $LOGGING_OPTS $WHIRR_CLI_OPTS -cp "$CLASSPATH" org.apache.whirr.cli.Main "$@"
1  cli/src/main/java/org/apache/whirr/cli/command/CleanupClusterCommand.java
View
@@ -62,6 +62,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
+ printProviderInfo(out, err, clusterSpec, optionSet);
ClusterController controller = createClusterController(clusterSpec.getServiceName());
controller.cleanupCluster(clusterSpec);
return 0;
1  cli/src/main/java/org/apache/whirr/cli/command/DestroyClusterCommand.java
View
@@ -54,6 +54,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
}
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
+ printProviderInfo(out, err, clusterSpec, optionSet);
return run(in, out, err, clusterSpec);
} catch (IllegalArgumentException e) {
1  cli/src/main/java/org/apache/whirr/cli/command/DestroyInstanceCommand.java
View
@@ -64,6 +64,7 @@ public int run(InputStream in, PrintStream out,
}
ClusterSpec clusterSpec = getClusterSpec(optionSet);
String instanceId = optionSet.valueOf(instanceOption);
+ printProviderInfo(out, err, clusterSpec, optionSet);
return run(in, out, err, clusterSpec, instanceId);
} catch (IllegalArgumentException e) {
11 cli/src/main/java/org/apache/whirr/cli/command/LaunchClusterCommand.java
View
@@ -18,6 +18,10 @@
package org.apache.whirr.cli.command;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.List;
import joptsimple.OptionSet;
import org.apache.whirr.Cluster;
import org.apache.whirr.ClusterController;
@@ -26,11 +30,6 @@
import org.apache.whirr.command.AbstractClusterCommand;
import org.apache.whirr.util.Utils;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.List;
-
/**
* A command to launch a new cluster.
*/
@@ -47,7 +46,6 @@ public LaunchClusterCommand(ClusterControllerFactory factory) {
@Override
public int run(InputStream in, PrintStream out, PrintStream err,
List<String> args) throws Exception {
-
OptionSet optionSet = parser.parse(args.toArray(new String[args.size()]));
if (!optionSet.nonOptionArguments().isEmpty()) {
@@ -57,6 +55,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
+ printProviderInfo(out, err, clusterSpec, optionSet);
return run(in, out, err, clusterSpec);
} catch (IllegalArgumentException e) {
1  cli/src/main/java/org/apache/whirr/cli/command/ListClusterCommand.java
View
@@ -63,6 +63,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
}
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
+ printProviderInfo(out, err, clusterSpec, optionSet);
return run(in, out, err, clusterSpec);
} catch (IllegalArgumentException e) {
1  cli/src/main/java/org/apache/whirr/cli/command/RoleLifecycleCommand.java
View
@@ -69,6 +69,7 @@ public int run(InputStream in, PrintStream out, PrintStream err, List<String> ar
try {
ClusterSpec clusterSpec = getClusterSpec(optionSet);
+ printProviderInfo(out, err, clusterSpec, optionSet);
return runLifecycleStep(
clusterSpec,
createClusterController(clusterSpec.getServiceName()),
1  cli/src/main/java/org/apache/whirr/cli/command/RunScriptCommand.java
View
@@ -107,6 +107,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
if (optionSet.has(rolesOption)) {
roles = optionSet.valueOf(rolesOption).split(",");
}
+ printProviderInfo(out, err, clusterSpec, optionSet);
return run(in, out, err, clusterSpec, ids, roles, optionSet.valueOf(scriptOption));
} catch (IllegalArgumentException e) {
22 core/src/main/java/org/apache/whirr/command/AbstractClusterCommand.java
View
@@ -60,12 +60,7 @@
protected OptionParser parser = new OptionParser();
private Map<Property, OptionSpec<?>> optionSpecs;
- private OptionSpec<String> configOption = parser
- .accepts("config", "Note that Whirr properties specified in " +
- "this file should all have a whirr. prefix.")
- .withRequiredArg()
- .describedAs("config.properties")
- .ofType(String.class);
+ private OptionSpec<String> configOption;
public AbstractClusterCommand(String name, String description, ClusterControllerFactory factory) {
this(name, description, factory, new ClusterStateStoreFactory());
@@ -75,6 +70,14 @@ public AbstractClusterCommand(String name, String description, ClusterController
ClusterStateStoreFactory stateStoreFactory) {
super(name, description);
+ configOption = parser.accepts("config", "Note that Whirr properties specified in " +
+ "this file should all have a whirr. prefix.")
+ .withRequiredArg()
+ .describedAs("config.properties")
+ .ofType(String.class);
+
+ parser.accepts("quiet", "Be less verbose");
+
this.factory = factory;
this.stateStoreFactory = stateStoreFactory;
@@ -156,6 +159,13 @@ protected ClusterStateStore createClusterStateStore(ClusterSpec spec) {
return stateStoreFactory.create(spec);
}
+ protected void printProviderInfo(PrintStream out, PrintStream err,
+ ClusterSpec clusterSpec, OptionSet optionSet) {
+ if (!optionSet.has("quiet")) {
+ out.println(String.format("Running on provider %s using identity %s", clusterSpec.getProvider(), clusterSpec.getIdentity()));
+ }
+ }
+
/**
* Print command execution error and a hint to help the user get more help
*/
Please sign in to comment.
Something went wrong with that request. Please try again.