From 5a8a4e7907d1ca1abc55ed46e3509592b03d657c Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 28 Sep 2018 14:32:59 -0700 Subject: [PATCH] acme2: Display any errors when cleaning up challenge --- src/cert/acme2.js | 8 ++++---- src/dns/godaddy.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cert/acme2.js b/src/cert/acme2.js index 782bbec7e..863edff1d 100644 --- a/src/cert/acme2.js +++ b/src/cert/acme2.js @@ -424,9 +424,7 @@ Acme2.prototype.cleanupHttpChallenge = function (hostname, domain, challenge, ca assert.strictEqual(typeof challenge, 'object'); assert.strictEqual(typeof callback, 'function'); - safe.fs.unlinkSync(path.join(paths.ACME_CHALLENGES_DIR, challenge.token)); - - callback(); + fs.unlinkSync(path.join(paths.ACME_CHALLENGES_DIR, challenge.token), callback); }; function getChallengeSubdomain(hostname, domain) { @@ -567,7 +565,9 @@ Acme2.prototype.acmeFlow = function (hostname, domain, callback) { that.waitForOrder.bind(that, orderUrl), that.downloadCertificate.bind(that, hostname) ], function (error) { - that.cleanupChallenge(hostname, domain, challenge, function () { + that.cleanupChallenge(hostname, domain, challenge, function (cleanupError) { + if (error) debug('acmeFlow: ignoring error when cleaning up challenge:', cleanupError); + iteratorCallback(error); }); }); diff --git a/src/dns/godaddy.js b/src/dns/godaddy.js index 16e0a5866..3c17ac91e 100644 --- a/src/dns/godaddy.js +++ b/src/dns/godaddy.js @@ -109,7 +109,7 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { debug(`get: ${subdomain} in zone ${zoneName} of type ${type} with values ${JSON.stringify(values)}`); - if (type !== 'A') return callback(new DomainsError(DomainsError.EXTERNAL_ERROR, new Error('Not supported by GoDaddy API'))); // can never happen + if (type !== 'A') return callback(new DomainsError(DomainsError.EXTERNAL_ERROR, new Error('Record deletion is not supported by GoDaddy API'))); // check if the record exists at all so that we don't insert the "Dead" record for no reason get(dnsConfig, zoneName, subdomain, type, function (error, values) {