This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 83d80a8e2c7f254859b814e244eb352456a17869
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Oct 6 15:01:37 2023 +0100

    better detection of dev env and disablement of host-geo lookup
---
 core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java    | 2 +-
 .../java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java     | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java 
b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
index 0ba4a5cc4f..5aa64f2060 100644
--- a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
+++ b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java
@@ -250,7 +250,7 @@ public class BrooklynVersion implements 
BrooklynVersionService {
         while (paths.hasMoreElements()) {
             URL u = paths.nextElement();
             // running fram a classes directory (including coverage-classes 
for cobertura) triggers dev env
-            if 
(u.getPath().endsWith("org/apache/brooklyn/core/BrooklynVersion.class")) {
+            if 
(u.getPath().endsWith("org/apache/brooklyn/core/BrooklynVersion.class") && 
"file".equals(u.getProtocol()) && !u.toString().contains("!")) {
                 try {
                     log.debug("Brooklyn dev/src environment detected: 
BrooklynVersion class is at: " + u);
                     return true;
diff --git 
a/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java 
b/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
index ced6b7ce97..4fcf71717f 100644
--- a/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
+++ b/core/src/main/java/org/apache/brooklyn/core/location/geo/HostGeoInfo.java
@@ -26,6 +26,7 @@ import javax.annotation.Nullable;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.location.AddressableLocation;
 import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.core.BrooklynFeatureEnablement;
 import org.apache.brooklyn.core.location.AbstractLocation;
 import org.apache.brooklyn.core.location.LocationConfigKeys;
 import org.apache.brooklyn.util.core.ClassLoaderUtils;
@@ -146,6 +147,11 @@ public class HostGeoInfo implements Serializable {
     private static boolean warnedLegacy = false;
     
     private static HostGeoLookup findHostGeoLookupImpl() throws 
InstantiationException, IllegalAccessException, ClassNotFoundException {
+        if 
(!BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_HOST_GEO_LOOKUP))
 {
+            log.debug("Host geo lookup feature not enabled. Returning null. 
Set system property "+BrooklynFeatureEnablement.FEATURE_HOST_GEO_LOOKUP+" to 
permit.");
+            return null;
+        }
+
         String type = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getValue();
         if (type==null) {
             type = 
BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL_LEGACY.getValue();

Reply via email to