[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] brooklyn-server pull request #953: Defers reading of config in SshCommandSen...

Github user aledsage commented on a diff in the pull request:

    --- Diff: core/src/main/java/org/apache/brooklyn/core/sensor/ssh/SshCommandSensor.java ---
    @@ -126,7 +118,7 @@ public String get() {
                     // Note that entity may be null during rebind (e.g. if this SshFeed is orphaned, with no associated entity):
                     // See https://issues.apache.org/jira/browse/BROOKLYN-568.
                     // We therefore guard against null in makeCommandExecutingInDirectory.
    -                return makeCommandExecutingInDirectory(command, executionDir, entity);
    +                return makeCommandExecutingInDirectory(params.get(SENSOR_COMMAND), params.get(SENSOR_EXECUTION_DIR), entity);
    --- End diff --
    I think we should do the `checkNotNull(params.get(SENSOR_COMMAND), ...)` in this `Supplier` method, and then pass it into the `makeCommandExecutingInDirectory`.
    If this were null, then things can go very strange. For example, we might try to execute `null` when we construct the command via:
    `finalCommand = "mkdir -p '"+execDir+"' && cd '"+execDir+"' && "+finalCommand`