zrhoffman commented on code in PR #7205:
URL: https://github.com/apache/trafficcontrol/pull/7205#discussion_r1026738995


##########
traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/ZoneManager.java:
##########
@@ -453,6 +454,17 @@ private static List<Record> fillZones(final Map<String, 
List<Record>> zoneMap, f
                return records;
        }
 
+       protected static String getTRLocalHostname(final TrafficRouter tr) 
throws UnknownHostException {
+               // if there is only one TR in the CRConfig, just use that TR's 
hostname
+               // instead of checking for the local server's hostname
+               final boolean singleTR = 
Iterators.size(tr.getCacheRegister().getTrafficRouters().fieldNames()) == 1;

Review Comment:
   This would break if `CacheRegister.getTrafficRouters()` returns null, but 
that that won't typically happen, since
   
   
https://github.com/apache/trafficcontrol/blob/d8a52630d70e7459720b2443c69a378020bcbd95/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/config/ConfigHandler.java#L180
   
   would error out if `"contentRouters"` is undefined.
   
   And `"contentRouters"` is `omitempty` in `tc.CRConfig`
   
   
https://github.com/apache/trafficcontrol/blob/d8a52630d70e7459720b2443c69a378020bcbd95/lib/go-tc/crconfig.go#L27
   
   , so `"contentRouters"` would not be `null` or explicitly `undefined`. This 
seems okay as-is



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to