You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2018/08/21 20:29:46 UTC

[trafficcontrol] branch master updated: Improved logging around missing certificates. This resolves #2730.

This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c534cf  Improved logging around missing certificates. This resolves #2730.
0c534cf is described below

commit 0c534cfa027e8f2ca2e0601b67421ff7a49dea31
Author: Jeff Elsloo <je...@cable.comcast.com>
AuthorDate: Tue Aug 21 14:08:56 2018 -0600

    Improved logging around missing certificates. This resolves #2730.
---
 .../traffic_router/core/config/CertificateChecker.java        | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
index 3c2c1f7..6392414 100644
--- a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
+++ b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/CertificateChecker.java
@@ -45,11 +45,18 @@ public class CertificateChecker {
 	public boolean certificatesAreValid(final List<CertificateData> certificateDataList, final JsonNode deliveryServicesJson) {
 
 		final Iterator<String> deliveryServiceIdIter = deliveryServicesJson.fieldNames();
+		boolean invalidConfig = false;
+
 		while (deliveryServiceIdIter.hasNext()) {
 			if (!deliveryServiceHasValidCertificates(certificateDataList, deliveryServicesJson, deliveryServiceIdIter.next())) {
-				return false;
+				invalidConfig = true; // individual DS errors are logged when deliveryServiceHasValidCertificates() is called
 			}
 		}
+
+		if (invalidConfig) {
+			return false;
+		}
+
 		return true;
 	}
 
@@ -61,7 +68,7 @@ public class CertificateChecker {
 	}
 
     @SuppressWarnings("PMD.CyclomaticComplexity")
-	private Boolean deliveryServiceHasValidCertificates(final List<CertificateData> certificateDataList, final JsonNode deliveryServicesJson, final String deliveryServiceId) {
+	private boolean deliveryServiceHasValidCertificates(final List<CertificateData> certificateDataList, final JsonNode deliveryServicesJson, final String deliveryServiceId) {
 		final JsonNode deliveryServiceJson = deliveryServicesJson.get(deliveryServiceId);
 		final JsonNode protocolJson = deliveryServiceJson.get("protocol");