bug6038: implemented a reverse DNS lookup in AwsLandscape.findHostnamesForIP

This commit is contained in:
Axel Uhl committed 2024-08-03 18:11:24 +02:00
1 parent 819e16b91c
commit 7b65604fe0
3 files changed
+9 -2

No files matched your search

@@ -123,6 +123,11 @@ public class ConnectivityTest<ProcessT extends AwsApplicationProcess<String, Sai
keyPass = "lkayrelakuesyrlasp8caorewyc".getBytes();
}
@Test
public void testReverseDNSLookup() {
assertEquals("mongo0.internal.sapsailing.com", landscape.findHostnamesForIP("172.31.13.233"));
}
@Test
public void testGetMasterOnApplicationProcess() throws Exception {
final Iterable<SailingAnalyticsHost<String>> hosts = landscape.getApplicationProcessHostsByTag(region,
@@ -762,7 +762,9 @@ public interface AwsLandscape<ShardingKey> extends Landscape<ShardingKey> {
* to that {@code ipAddress} and returns the record set name as the hostname. This searches
* the whole of all resource record sets in the AWS account.<p>
*
* Example: asking for "172.31.13.233" may return something like "mongo0.internal.sapsailing.com"
* Example: asking for "172.31.13.233" may return something like "mongo0.internal.sapsailing.com"<p>
*
* Note that this strips off any trailing "." (dot) from a resource record set name.
*
* @return the fully-qualified resource record set name if found, otherwise {@code null}
*/
@@ -1761,7 +1761,7 @@ public class AwsLandscapeImpl<ShardingKey> implements AwsLandscape<ShardingKey>
for (final ResourceRecordSet resourceRecordSet : route53Client.listResourceRecordSets(b->b.hostedZoneId(hostedZone.id())).resourceRecordSets()) {
for (final ResourceRecord resourceRecord : resourceRecordSet.resourceRecords()) {
if (Util.equalsWithNull(resourceRecord.value(), ipAddress)) {
return resourceRecordSet.name();
return resourceRecordSet.name().replaceFirst("\\.$", "");
}
}
}