Github user neykov commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/333#discussion_r20403272
--- Diff:
locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocationResolver.java
---
@@ -177,17 +177,20 @@ public JcloudsLocation newLocationFromString(Map
locationFlags, String spec, bro
Map jcloudsProperties = new
JcloudsPropertiesFromBrooklynProperties().getJcloudsProperties(providerOrApi,
regionOrEndpoint, namedLocation, allProperties);
jcloudsProperties.putAll(locationFlags);
- if (isProvider) {
- // providers from ServiceLoader take a location (endpoint
already configured), and optionally a region name
- // NB blank might be supplied if spec string is "mycloud:" --
that should be respected,
- // whereas no parameter/regionName ie null value -- "mycloud"
-- means don't set
- if (regionOrEndpoint!=null)
-
jcloudsProperties.put(JcloudsLocationConfig.CLOUD_REGION_ID.getName(),
regionOrEndpoint);
- } else {
- // other "providers" are APIs so take an _endpoint_ (but not a
location);
- // see note above re null here
- if (regionOrEndpoint!=null)
-
jcloudsProperties.put(JcloudsLocationConfig.CLOUD_ENDPOINT.getName(),
regionOrEndpoint);
+ if (regionOrEndpoint!=null) {
+ // apply the regionOrEndpoint (e.g. from the parameter) as
appropriate -- but only if it has not been overridden
+ if (isProvider) {
+ // providers from ServiceLoader take a location (endpoint
already configured), and optionally a region name
+ // NB blank might be supplied if spec string is "mycloud:"
-- that should be respected,
+ // whereas no parameter/regionName ie null value --
"mycloud" -- means don't set
+ if (regionOrEndpoint!=null &&
Strings.isBlank(Strings.toString(jcloudsProperties.get(JcloudsLocationConfig.CLOUD_REGION_ID.getName()))))
--- End diff --
Already checked non-null regionOrEndpoint above.
---
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.
---