Github user bostko commented on a diff in the pull request: https://github.com/apache/incubator-brooklyn/pull/1087#discussion_r48627640 --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java --- @@ -1608,7 +1608,36 @@ protected SshMachineLocation createTemporarySshMachineLocation(HostAndPort hostA } } - + /** + * Creates a temporary WinRM machine location (i.e. will not be persisted), which uses the given credentials. + * It ignores any credentials (e.g. password, key-phrase, etc) that are supplied in the config. + */ + protected WinRmMachineLocation createTemporaryWinRmMachineLocation(HostAndPort hostAndPort, LoginCredentials creds, ConfigBag config) { + String initialUser = creds.getUser(); + Optional<String> initialPassword = creds.getOptionalPassword(); + Optional<String> initialPrivateKey = creds.getOptionalPrivateKey(); + + Map<String,Object> winrmProps = Maps.newLinkedHashMap(config.getAllConfig()); + winrmProps.put("user", initialUser); + winrmProps.put("address", hostAndPort.getHostText()); + winrmProps.put("port", hostAndPort.getPort()); + winrmProps.put(AbstractLocation.TEMPORARY_LOCATION.getName(), true); + winrmProps.put(LocalLocationManager.CREATE_UNMANAGED.getName(), true); + winrmProps.remove("password"); + winrmProps.remove("privateKeyData"); + winrmProps.remove("privateKeyFile"); + winrmProps.remove("privateKeyPassphrase"); + + if (initialPassword.isPresent()) winrmProps.put("password", initialPassword.get()); + if (initialPrivateKey.isPresent()) winrmProps.put("privateKeyData", initialPrivateKey.get()); + + if (isManaged()) { + return getManagementContext().getLocationManager().createLocation(winrmProps, WinRmMachineLocation.class); --- End diff -- This location is temporary. Why do we have to manage it (i.e. persist it)?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---