You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ri...@apache.org on 2018/04/16 14:00:01 UTC

[1/2] brooklyn-server git commit: SSH Sensor value-on-error

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 4236ff272 -> 30ce7faea


SSH Sensor value-on-error

Adds `value.on.error` config key to SshCommandSensor to allow a value
to be specified for use when an exception occurs when executing the
ssh command


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5a353b6e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5a353b6e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5a353b6e

Branch: refs/heads/master
Commit: 5a353b6ed41f45e43cb9bdf0ac590dc8c1613124
Parents: 4236ff2
Author: Martin Harris <gi...@nakomis.com>
Authored: Mon Apr 16 12:34:11 2018 +0100
Committer: Martin Harris <gi...@nakomis.com>
Committed: Mon Apr 16 13:10:55 2018 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5a353b6e/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java
index 84b7322..6224ed3 100644
--- a/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java
@@ -70,6 +70,8 @@ public final class SshCommandSensor<T> extends AbstractAddSensorFeed<T> {
     public static final ConfigKey<String> SENSOR_EXECUTION_DIR = ConfigKeys.newStringConfigKey("executionDir", "Directory where the command should run; "
         + "if not supplied, executes in the entity's run dir (or home dir if no run dir is defined); "
         + "use '~' to always execute in the home dir, or 'custom-feed/' to execute in a custom-feed dir relative to the run dir");
+    public static final ConfigKey<Object> VALUE_ON_ERROR = ConfigKeys.newConfigKey(Object.class, "value.on.error",
+            "Value to be used if an error occurs whilst executing the ssh command", null);
     public static final MapConfigKey<Object> SENSOR_SHELL_ENVIRONMENT = BrooklynConfigKeys.SHELL_ENVIRONMENT;
 
     protected final String command;
@@ -136,7 +138,7 @@ public final class SshCommandSensor<T> extends AbstractAddSensorFeed<T> {
                 .command(commandSupplier)
                 .suppressDuplicates(Boolean.TRUE.equals(suppressDuplicates))
                 .checkSuccess(SshValueFunctions.exitStatusEquals(0))
-                .onFailureOrException(Functions.constant((T) null))
+                .onFailureOrException(Functions.constant((T)params.get(VALUE_ON_ERROR)))
                 .onSuccess(Functions.compose(new Function<String, T>() {
                         @Override
                         public T apply(String input) {


[2/2] brooklyn-server git commit: Review and close #956

Posted by ri...@apache.org.
Review and close #956


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/30ce7fae
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/30ce7fae
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/30ce7fae

Branch: refs/heads/master
Commit: 30ce7faeaaa51bc4157659baf038af0445e0ce2d
Parents: 4236ff2 5a353b6
Author: Richard Downer <ri...@apache.org>
Authored: Mon Apr 16 14:59:41 2018 +0100
Committer: Richard Downer <ri...@apache.org>
Committed: Mon Apr 16 14:59:41 2018 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------