Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BB07B200AE1 for ; Mon, 6 Jun 2016 16:45:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B9904160A5E; Mon, 6 Jun 2016 14:45:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0D401160A1E for ; Mon, 6 Jun 2016 16:45:56 +0200 (CEST) Received: (qmail 69724 invoked by uid 500); 6 Jun 2016 14:45:56 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 69679 invoked by uid 99); 6 Jun 2016 14:45:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jun 2016 14:45:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DB6B9E00A7; Mon, 6 Jun 2016 14:45:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: svet@apache.org To: commits@brooklyn.apache.org Date: Mon, 06 Jun 2016 14:45:57 -0000 Message-Id: In-Reply-To: <9ed7a8c430c04542a42c5ea02eaa3f5b@git.apache.org> References: <9ed7a8c430c04542a42c5ea02eaa3f5b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/9] brooklyn-server git commit: Adds JcloudsLocation.LOOKUP_AWS_HOSTNAME archived-at: Mon, 06 Jun 2016 14:45:57 -0000 Adds JcloudsLocation.LOOKUP_AWS_HOSTNAME Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e6be5b1c Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e6be5b1c Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e6be5b1c Branch: refs/heads/master Commit: e6be5b1c10035e3c0b3a0773e1556f97ae321d69 Parents: 6a1ac3f Author: Aled Sage Authored: Wed Jun 1 17:34:17 2016 +0100 Committer: Aled Sage Committed: Mon Jun 6 15:10:09 2016 +0100 ---------------------------------------------------------------------- .../apache/brooklyn/location/jclouds/JcloudsLocation.java | 9 ++++++--- .../brooklyn/location/jclouds/JcloudsLocationConfig.java | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e6be5b1c/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java index c87678f..fb68819 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java @@ -3072,9 +3072,10 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im */ protected String getPublicHostname(NodeMetadata node, Optional sshHostAndPort, LoginCredentials userCredentials, ConfigBag setup) { String provider = (setup != null) ? setup.get(CLOUD_PROVIDER) : null; + Boolean lookupAwsHostname = (setup != null) ? setup.get(LOOKUP_AWS_HOSTNAME) : null; if (provider == null) provider= getProvider(); - if ("aws-ec2".equals(provider)) { + if ("aws-ec2".equals(provider) && Boolean.TRUE.equals(lookupAwsHostname)) { HostAndPort inferredHostAndPort = null; if (!sshHostAndPort.isPresent()) { try { @@ -3168,12 +3169,14 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im protected String getPrivateHostname(NodeMetadata node, Optional sshHostAndPort, LoginCredentials userCredentials, ConfigBag setup) { String provider = (setup != null) ? setup.get(CLOUD_PROVIDER) : null; - if (provider == null) provider= getProvider(); + Boolean lookupAwsHostname = (setup != null) ? setup.get(LOOKUP_AWS_HOSTNAME) : null; + + if (provider == null) provider = getProvider(); // TODO Discouraged to do cloud-specific things; think of this code for aws as an // exceptional situation rather than a pattern to follow. We need a better way to // do cloud-specific things. - if ("aws-ec2".equals(provider)) { + if ("aws-ec2".equals(provider) && Boolean.TRUE.equals(lookupAwsHostname)) { Maybe result = getPrivateHostnameAws(node, sshHostAndPort, userCredentials, setup); if (result.isPresent()) return result.get(); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e6be5b1c/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java ---------------------------------------------------------------------- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java index 1403a9f..35da672 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java @@ -234,6 +234,12 @@ public interface JcloudsLocationConfig extends CloudLocationConfig { + "This config is beta; its default could be changed and/or the option removed in an upcoming release.", true); + @Beta + public static final ConfigKey LOOKUP_AWS_HOSTNAME = ConfigKeys.newBooleanConfigKey( + "lookupAwsHostname", + "Whether to lookup the AWS hostname (via a command on the VM), or to just use the IP.", + true); + public static final ConfigKey PORT_FORWARDER = ConfigKeys.newConfigKey( JcloudsPortForwarderExtension.class, "portforwarding.forwarder", "The port-forwarder to use");