If cert renewal failed, continue using old cert

This commit is contained in:
Girish Ramakrishnan
2019-10-03 10:46:03 -07:00
parent 7e75ef7685
commit 0542ab16d4

View File

@@ -352,7 +352,7 @@ function ensureCertificate(vhost, domain, auditSource, callback) {
getCertApi(domainObject, function (error, api, apiOptions) {
if (error) return callback(error);
getCertificateByHostname(vhost, domainObject, function (error, currentBundle) {
getCertificateByHostname(vhost, domainObject, function (_error, currentBundle) {
if (currentBundle) {
debug(`ensureCertificate: ${vhost} certificate already exists at ${currentBundle.keyFilePath}`);
@@ -370,6 +370,11 @@ function ensureCertificate(vhost, domain, auditSource, callback) {
eventlog.add(currentBundle ? eventlog.ACTION_CERTIFICATE_RENEWAL : eventlog.ACTION_CERTIFICATE_NEW, auditSource, { domain: vhost, errorMessage: error ? error.message : '' });
if (error && currentBundle && !isExpiringSync(currentBundle.certFilePath, 0)) {
debug('ensureCertificate: continue using existing bundle since renewal failed');
return callback(null, currentBundle, { renewed: false });
}
notifyCertChanged(vhost, function (error) {
if (error) return callback(error);