brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #596: WinRmCommandSensor default executionDir
Date Wed, 15 Mar 2017 15:52:15 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/596#discussion_r106203683
  
    --- Diff: software/winrm/src/main/java/org/apache/brooklyn/core/sensor/windows/WinRmCommandSensor.java
---
    @@ -144,15 +144,7 @@ public T apply(String input) {
         public static String makeCommandExecutingInDirectory(String command, String executionDir,
Entity entity) {
             String finalCommand = command;
             String execDir = executionDir;
    -        if (Strings.isBlank(execDir)) {
    -            // default to run dir
    -            execDir = entity.getAttribute(BrooklynConfigKeys.RUN_DIR);
    -            // if no run dir, default to home
    -            if (Strings.isBlank(execDir)) {
    -                execDir = "%USERPROFILE%";
    -            }
    -        }
    -        if (!"~".equals(execDir)) {
    +        if (Strings.isNonBlank(execDir) && !"~".equals(execDir)) {
    --- End diff --
    
    That's nice as a temporary patch around the fact that `RUN_DIR` is set to a UNIX-y path.
What's the default folder we get on login? Is there a risk in executing in a protected folder
(`C:\Windows\system32`) which will fail the code if it writes to the file system?
    What if we keep the `%USERPROFILE%` default?
    I thought this is executed as powershell, which makes the next line look like it would
fail - how does it work then?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message