diff options
author | jonmv <venstad@gmail.com> | 2024-01-05 10:15:32 +0100 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2024-01-05 10:15:32 +0100 |
commit | 6d9ca2f17e1747d47d09f19801a2d52fded1f486 (patch) | |
tree | 122c86d60f4c33f6d03b19fea5cd7a485699ef95 /config-model | |
parent | 2e2b8512a690af8e1aa700358df62387f71911ef (diff) |
Use Context.illegal to report illegal configuration
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/application/validation/CloudClientsValidator.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/CloudClientsValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/CloudClientsValidator.java index 2882489ef0a..557df5c7324 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/CloudClientsValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/CloudClientsValidator.java @@ -1,6 +1,6 @@ package com.yahoo.vespa.model.application.validation; -import com.yahoo.config.model.deploy.DeployState; +import com.yahoo.vespa.model.application.validation.Validation.Context; import org.bouncycastle.asn1.x509.TBSCertificate; import java.security.cert.CertificateEncodingException; @@ -19,12 +19,12 @@ public class CloudClientsValidator implements Validator { if (!ctx.deployState().isHosted()) return; ctx.model().getContainerClusters().forEach((clusterName, cluster) -> { for (var client : cluster.getClients()) { - client.certificates().forEach(cert -> validateCertificate(clusterName, client.id(), cert, ctx.deployState())); + client.certificates().forEach(cert -> validateCertificate(clusterName, client.id(), cert, ctx)); } }); } - static void validateCertificate(String clusterName, String clientId, X509Certificate cert, DeployState state) { + static void validateCertificate(String clusterName, String clientId, X509Certificate cert, Context ctx) { try { var extensions = TBSCertificate.getInstance(cert.getTBSCertificate()).getExtensions(); if (extensions == null) return; // Certificate without any extensions is okay @@ -42,10 +42,10 @@ public class CloudClientsValidator implements Validator { "Please update the application package with a new certificate, " + "e.g by generating a new one using the Vespa CLI `$ vespa auth cert`. " + "Such certificate will no longer be accepted in near future."; - state.getDeployLogger().log(Level.WARNING, errorMessage(clusterName, clientId, message)); + ctx.deployState().getDeployLogger().log(Level.WARNING, errorMessage(clusterName, clientId, message)); } } catch (CertificateEncodingException e) { - throw new IllegalArgumentException(errorMessage(clusterName, clientId, e.getMessage()), e); + ctx.illegal(errorMessage(clusterName, clientId, e.getMessage()), e); } } |