package com.yahoo.vespa.model.application.validation;

import com.yahoo.config.model.api.TlsSecrets;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.vespa.model.VespaModel;

public class TlsSecretsValidator extends Validator {

    /** This check is delayed until validation to allow node provisioning to complete while we are waiting for cert */
    @Override
    public void validate(VespaModel model, DeployState deployState) {
        if (deployState.tlsSecrets().isPresent() && deployState.tlsSecrets().get() == TlsSecrets.MISSING) {
            throw new IllegalArgumentException("TLS enabled, but could not retrieve certificate yet");
        }
    }
}

@@ -144,16 +144,80 @@
 yState;%0A
+import com.yahoo.config.provision.CertificateNotReadyException;%0A
 import c
@@ -641,23 +641,27 @@
 new 
-IllegalArgument
+CertificateNotReady
 Exce

throw designated exception