brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [2/5] git commit: tidy code for rebinding following code review
Date Fri, 30 May 2014 15:15:13 GMT
tidy code for rebinding following code review


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/871489a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/871489a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/871489a6

Branch: refs/heads/master
Commit: 871489a69572968d9c7cca9a925d5a1d1e25bc37
Parents: cda7169
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed May 28 21:05:24 2014 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed May 28 21:05:24 2014 +0100

----------------------------------------------------------------------
 .../location/jclouds/JcloudsLocation.java       | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/871489a6/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
index b714991..79c0219 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
@@ -1441,10 +1441,8 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation
im
             String user = checkNotNull(getUser(setup), "user");
             final String rawRegion = (String) setup.getStringKey("region");
             
-//            String id = rawId.contains("/") ? rawId : (((rawRegion != null) ? rawRegion+"/"
: "") + rawId);
-            
             LOG.info("Rebinding to VM {} ({}@{}), in jclouds location for provider {}", 
-                    new Object[] {rawId==null ? "<lookup>" : rawId, 
+                    new Object[] {rawId!=null ? rawId : "<lookup>", 
                         user, 
                         (rawHostname != null ? rawHostname : "<unspecified>"), 
                         getProvider()});
@@ -1455,13 +1453,17 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation
im
                 @Override
                 public boolean apply(ComputeMetadata input) {
                     // ID exact match
-                    if (rawId!=null && rawId.equals(input.getId())) return true;
-                    // AWS format
-                    if (rawId!=null && rawRegion!=null && (rawRegion+"/"+rawId).equals(input.getId()))
return true;
+                    if (rawId!=null) {
+                        if (rawId.equals(input.getId())) return true;
+                        // AWS format
+                        if (rawRegion!=null && (rawRegion+"/"+rawId).equals(input.getId()))
return true;
+                    }
                     // else do node metadata lookup
                     if (!(input instanceof NodeMetadata)) return false;
-                    if (rawHostname.equalsIgnoreCase( ((NodeMetadata)input).getHostname()
)) return true;
-                    if (((NodeMetadata)input).getPublicAddresses().contains(rawHostname))
return true;
+                    if (rawHostname!=null) {
+                        if (rawHostname.equalsIgnoreCase( ((NodeMetadata)input).getHostname()
)) return true;
+                        if (((NodeMetadata)input).getPublicAddresses().contains(rawHostname))
return true;
+                    }
                     // don't do private IP's because those might be repeated
                     return false;
                 }
@@ -1481,8 +1483,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation
im
             }
             
             // TODO confirm we can SSH ?
-            // and if rawHostname not set, might want to do:
-            // getPublicHostname(node, Optional.<HostAndPort>absent(), setup);
+            // NB if rawHostname not set, get the hostname using getPublicHostname(node,
Optional.<HostAndPort>absent(), setup);
 
             return registerJcloudsSshMachineLocation(computeService, node, null, Optional.<HostAndPort>absent(),
setup);
             


Mime
View raw message