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

    https://github.com/apache/incubator-brooklyn/pull/866#discussion_r37966626
  
    --- Diff: 
software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
 ---
    @@ -37,31 +42,36 @@ public void start() {
     
             super.start();
         }
    -    
    +
         @Override
    -    public void preInstall() {
    -        super.preInstall();
    -        executeCommand(VanillaWindowsProcess.PRE_INSTALL_COMMAND, 
VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND, true);
    -        if 
(entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) {
    -            rebootAndWait();
    +    public void runPreInstallCommand() {
    +        
if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND))
 || 
Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND)))
 {
    +            executeCommand(VanillaWindowsProcess.PRE_INSTALL_COMMAND, 
VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND, true);
    +            if 
(entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) {
    --- End diff --
    
    If one had configured `PRE_INSTALL_REBOOT_REQUIRED` without any pre install 
command, we should still execute it. Let's move this check outside of the outer 
if block.
    
    Also, I'd use `if 
(Boolean.TRUE.equals(entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)))
 {`. Otherwise there is a risk of a NullPointerException if the config 
parameter's value is null.


---
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