brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbouron <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #849: Retrieve the right AWS metadata for priva...
Date Mon, 02 Oct 2017 14:16:59 GMT
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/849#discussion_r142150833
  
    --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
---
    @@ -2957,7 +2957,7 @@ String getHostnameAws(HostAndPort hostAndPort, LoginCredentials
userCredentials,
                         "get public AWS hostname",
                         ImmutableList.of(
                                 BashCommands.INSTALL_CURL,
    -                            "echo `curl --silent --retry 20 http://169.254.169.254/latest/meta-data/public-hostname`;
exit"));
    +                            "echo `curl --silent --retry 20 http://169.254.169.254/latest/meta-data/"+(privateHost
? "local-hostname" : "public-hostname")+"`; exit"));
    --- End diff --
    
    @andreaturli In you code example, `http://169.254.169.254/latest/meta-data/local-hostname`
will always return a `200` (as an EC2 instance always as a private IP) so your if statement
will always go one way which is not what we want here.
    
    It would may be easier to read (although I'm not sure about that) but will also introduce
some code duplication which I would be reluctant do to, especially in this huge file.
    



---

Mime
View raw message