diff --git a/server/src/main/java/org/elasticsearch/transport/TransportInfo.java b/server/src/main/java/org/elasticsearch/transport/TransportInfo.java index c738cbe552c5f..cc69c493d8138 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportInfo.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportInfo.java @@ -11,49 +11,25 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.logging.DeprecationCategory; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.network.InetAddresses; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.util.Maps; import org.elasticsearch.core.Nullable; -import org.elasticsearch.core.UpdateForV9; import org.elasticsearch.node.ReportingService; import org.elasticsearch.xcontent.XContentBuilder; import java.io.IOException; import java.util.Map; -import static org.elasticsearch.core.Booleans.parseBoolean; - public class TransportInfo implements ReportingService.Info { - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TransportInfo.class); - - /** Whether to add hostname to publish host field when serializing. */ - @UpdateForV9 // Remove es.transport.cname_in_publish_address property from TransportInfo in 9.0.0 - private static final boolean CNAME_IN_PUBLISH_ADDRESS = parseBoolean( - System.getProperty("es.transport.cname_in_publish_address"), - false - ); - private final BoundTransportAddress address; private Map profileAddresses; - private final boolean cnameInPublishAddressProperty; public TransportInfo(BoundTransportAddress address, @Nullable Map profileAddresses) { - this(address, profileAddresses, CNAME_IN_PUBLISH_ADDRESS); - } - - public TransportInfo( - BoundTransportAddress address, - @Nullable Map profileAddresses, - boolean cnameInPublishAddressProperty - ) { this.address = address; this.profileAddresses = profileAddresses; - this.cnameInPublishAddressProperty = cnameInPublishAddressProperty; } public TransportInfo(StreamInput in) throws IOException { @@ -67,7 +43,6 @@ public TransportInfo(StreamInput in) throws IOException { profileAddresses.put(key, value); } } - this.cnameInPublishAddressProperty = CNAME_IN_PUBLISH_ADDRESS; } @Override @@ -97,16 +72,7 @@ private String formatPublishAddressString(String propertyName, TransportAddress String publishAddressString = publishAddress.toString(); String hostString = publishAddress.address().getHostString(); if (InetAddresses.isInetAddress(hostString) == false) { - publishAddressString = hostString + '/' + publishAddress.toString(); - if (cnameInPublishAddressProperty) { - deprecationLogger.warn( - DeprecationCategory.SETTINGS, - "cname_in_publish_address", - "es.transport.cname_in_publish_address system property is deprecated and no longer affects " - + propertyName - + " formatting. Remove this property to get rid of this deprecation warning." - ); - } + publishAddressString = hostString + '/' + publishAddress; } return publishAddressString; } diff --git a/server/src/test/java/org/elasticsearch/transport/TransportInfoTests.java b/server/src/test/java/org/elasticsearch/transport/TransportInfoTests.java index 4a84dc558711f..9bc8140850ba2 100644 --- a/server/src/test/java/org/elasticsearch/transport/TransportInfoTests.java +++ b/server/src/test/java/org/elasticsearch/transport/TransportInfoTests.java @@ -24,44 +24,31 @@ public class TransportInfoTests extends ESTestCase { - private TransportInfo createTransportInfo(InetAddress address, int port, boolean cnameInPublishAddressProperty) { + private TransportInfo createTransportInfo(InetAddress address, int port) { BoundTransportAddress boundAddress = new BoundTransportAddress( new TransportAddress[] { new TransportAddress(address, port) }, new TransportAddress(address, port) ); Map profiles = Collections.singletonMap("test_profile", boundAddress); - return new TransportInfo(boundAddress, profiles, cnameInPublishAddressProperty); + return new TransportInfo(boundAddress, profiles); } public void testCorrectlyDisplayPublishedCname() throws Exception { InetAddress address = InetAddress.getByName("localhost"); int port = 9200; - assertPublishAddress(createTransportInfo(address, port, false), "localhost/" + NetworkAddress.format(address) + ':' + port); - } - - public void testDeprecatedWarningIfPropertySpecified() throws Exception { - InetAddress address = InetAddress.getByName("localhost"); - int port = 9200; - assertPublishAddress(createTransportInfo(address, port, true), "localhost/" + NetworkAddress.format(address) + ':' + port); - assertWarnings( - "es.transport.cname_in_publish_address system property is deprecated and no longer affects " - + "transport.publish_address formatting. Remove this property to get rid of this deprecation warning.", - - "es.transport.cname_in_publish_address system property is deprecated and no longer affects " - + "transport.test_profile.publish_address formatting. Remove this property to get rid of this deprecation warning." - ); + assertPublishAddress(createTransportInfo(address, port), "localhost/" + NetworkAddress.format(address) + ':' + port); } public void testCorrectDisplayPublishedIp() throws Exception { InetAddress address = InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("localhost"))); int port = 9200; - assertPublishAddress(createTransportInfo(address, port, false), NetworkAddress.format(address) + ':' + port); + assertPublishAddress(createTransportInfo(address, port), NetworkAddress.format(address) + ':' + port); } public void testCorrectDisplayPublishedIpv6() throws Exception { InetAddress address = InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("0:0:0:0:0:0:0:1"))); int port = 9200; - assertPublishAddress(createTransportInfo(address, port, false), new TransportAddress(address, port).toString()); + assertPublishAddress(createTransportInfo(address, port), new TransportAddress(address, port).toString()); } @SuppressWarnings("unchecked") diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportNodeEnrollmentActionTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportNodeEnrollmentActionTests.java index 26bb64eb0b073..a4d94f9762e69 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportNodeEnrollmentActionTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportNodeEnrollmentActionTests.java @@ -113,7 +113,7 @@ public void testDoExecute() throws Exception { null, null, null, - new TransportInfo(new BoundTransportAddress(new TransportAddress[] { n.getAddress() }, n.getAddress()), null, false), + new TransportInfo(new BoundTransportAddress(new TransportAddress[] { n.getAddress() }, n.getAddress()), null), null, null, null,