letsencrypt: Return an error if making site folder fails

This commit is contained in:
Matthew Holt 2015-11-12 23:54:57 -07:00
parent 7d46a7d5f4
commit 94c746c44f

View File

@ -287,10 +287,13 @@ func obtainCertificates(client *acme.Client, serverConfigs []server.Config) ([]a
// metadata file.
func saveCertsAndKeys(certificates []acme.CertificateResource) error {
for _, cert := range certificates {
os.MkdirAll(storage.Site(cert.Domain), 0700)
err := os.MkdirAll(storage.Site(cert.Domain), 0700)
if err != nil {
return err
}
// Save cert
err := ioutil.WriteFile(storage.SiteCertFile(cert.Domain), cert.Certificate, 0600)
err = ioutil.WriteFile(storage.SiteCertFile(cert.Domain), cert.Certificate, 0600)
if err != nil {
return err
}