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

    https://github.com/apache/incubator-brooklyn/pull/1087#discussion_r46672018
  
    --- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 ---
    @@ -2537,28 +2563,53 @@ protected LoginCredentials 
waitForWinRmAvailable(final ComputeService computeSer
                 timeout = 
Duration.parse(WAIT_FOR_WINRM_AVAILABLE.getDefaultValue());
             }
             
    -        String user = expectedCredentials.getUser();
    -        String password = 
expectedCredentials.getOptionalPassword().orNull();
    -        int vmPort = hostAndPortOverride.isPresent() 
    -                ? hostAndPortOverride.get().getPortOrDefault(5985) 
    -                : 5985; // WinRM port
    -        String vmIp = hostAndPortOverride.isPresent() 
    -                ? hostAndPortOverride.get().getHostText() 
    -                : 
getFirstReachableAddress(NodeMetadataBuilder.fromNodeMetadata(node).loginPort(vmPort).build(),
 setup);
    -
    -        final Session session = 
WinRMFactory.INSTANCE.createSession(vmIp+":"+vmPort, user, password);
    -
    +        Set<String> users = Sets.newLinkedHashSet();
    +        for (LoginCredentials creds : credentialsToTry) {
    +            users.add(creds.getUser());
    +        }
    +        String user = (users.size() == 1) ? 
Iterables.getOnlyElement(users) : "{" + Joiner.on(",").join(users) + "}";
    +        String vmIp = hostAndPortOverride.isPresent() ? 
hostAndPortOverride.get().getHostText() : getFirstReachableAddress(node, setup);
             if (vmIp==null) LOG.warn("Unable to extract IP for "+node+" 
("+setup.getDescription()+"): subsequent connection attempt will likely fail");
    +        int vmPort = hostAndPortOverride.isPresent() ? 
hostAndPortOverride.get().getPortOrDefault(5985) : 5985;
    --- End diff --
    
    This would deserve a constant in a subsequent PR, repeated too much 
throughout the code.


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