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

    https://github.com/apache/brooklyn-server/pull/169#discussion_r65270164
  
    --- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 ---
    @@ -867,20 +873,41 @@ protected MachineLocation obtainOnce(ConfigBag setup) 
throws NoMachinesAvailable
                             String scriptContent = 
ResourceUtils.create(this).getResourceAsString(setupScriptItem);
                             String script = 
TemplateProcessor.processTemplateContents(scriptContent, 
getManagementContext(), substitutions);
                             if (windows) {
    -                            
((WinRmMachineLocation)machineLocation).executeCommand(ImmutableList.copyOf((script.replace("\r",
 "").split("\n"))));
    +                            WinRmToolResponse resp = 
((WinRmMachineLocation)machineLocation).executeCommand(ImmutableList.copyOf((script.replace("\r",
 "").split("\n"))));
    +                            if (resp.getStatusCode() != 0) {
    +                                throw new IllegalStateException("Command 
'Customizing node " + this + "' failed with exit code " + resp.getStatusCode() 
+ " for location " + machineLocation);
    +                            }
                             } else {
    -                            
((SshMachineLocation)machineLocation).execCommands("Customizing node " + this, 
ImmutableList.of(script));
    +                            executeCommandThrowingOnError(
    +                                    (SshMachineLocation)machineLocation,
    +                                    "Customizing node " + this,
    +                                    ImmutableList.of(script));
                             }
                         }
                     }
    +                
    +                Boolean dontRequireTtyForSudo = 
setup.get(JcloudsLocationConfig.DONT_REQUIRE_TTY_FOR_SUDO);
    +                if (Boolean.TRUE.equals(dontRequireTtyForSudo) ||
    +                        dontRequireTtyForSudo == null && 
setup.get(DONT_CREATE_USER)) {
    --- End diff --
    
    Minor: I prefer putting brackets around `dontRequireTtyForSudo == null && 
setup.get(DONT_CREATE_USER)`, so that folk don't need to worry about the 
precedence of `||` and `&&`.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to