If any challenge fails - return an error

This commit is contained in:
xenolf 2015-11-17 19:45:15 +01:00
parent 4801a4779e
commit c849ca1b90

View file

@ -239,22 +239,11 @@ func (c *Client) ObtainSANCertificate(domains []string, bundle bool) (Certificat
} }
errs := c.solveChallenges(challenges) errs := c.solveChallenges(challenges)
for k, v := range errs { // If any challenge fails - return. Do not generate partial SAN certificates.
failures[k] = v if len(errs) > 0 {
}
if len(failures) == len(domains) {
return CertificateResource{}, failures return CertificateResource{}, failures
} }
// remove failed challenges from slice
var succeededChallenges []authorizationResource
for _, chln := range challenges {
if failures[chln.Domain] == nil {
succeededChallenges = append(succeededChallenges, chln)
}
}
logf("[INFO] acme: Validations succeeded; requesting certificates") logf("[INFO] acme: Validations succeeded; requesting certificates")
cert, err := c.requestCertificate(succeededChallenges, bundle) cert, err := c.requestCertificate(succeededChallenges, bundle)