brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [4/5] brooklyn-server git commit: Fix LocalhostMachineProvisioningLocation’s address lookup
Date Wed, 07 Feb 2018 10:27:46 GMT
Fix LocalhostMachineProvisioningLocation’s address lookup

If given `address` then never call `getLocalhostInetAddress` (because
`BrooklynNetworkUtils.getLocalhostInetAddress` can take 500ms)

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5f15a0c7
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5f15a0c7
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5f15a0c7

Branch: refs/heads/master
Commit: 5f15a0c7a3a8ad0fee12e3ef6b8f8e3a38650a02
Parents: 440ae7a
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Feb 6 18:30:51 2018 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Feb 6 18:35:37 2018 +0000

----------------------------------------------------------------------
 .../localhost/LocalhostMachineProvisioningLocation.java         | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/5f15a0c7/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
index 9677f8c..4ebeda6 100644
--- a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
+++ b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
@@ -175,7 +175,7 @@ public class LocalhostMachineProvisioningLocation extends FixedListMachineProvis
         for (int i=0; i<size; i++) {
             Map<Object,Object> flags2 = MutableMap.<Object,Object>builder()
                     .putAll(flags)
-                    .put("address", elvis(address, getLocalhostInetAddress()))
+                    .put("address", (address != null ? address : getLocalhostInetAddress()))
                     .build();
             
             // copy inherited keys for ssh; 
@@ -318,8 +318,9 @@ public class LocalhostMachineProvisioningLocation extends FixedListMachineProvis
         
         @Override
         public LocalhostMachine configure(Map<?,?> properties) {
-            if (address==null || !properties.containsKey("address"))
+            if (address==null && !properties.containsKey("address")) {
                 address = getLocalhostInetAddress();
+            }
             super.configure(properties);
             return this;
         }


Mime
View raw message