diff --git a/src/dns/caas.js b/src/dns/caas.js index c51a2ef2d..d716bfd71 100644 --- a/src/dns/caas.js +++ b/src/dns/caas.js @@ -4,7 +4,6 @@ exports = module.exports = { upsert: upsert, get: get, del: del, - getChangeStatus: getChangeStatus, waitForDns: require('./waitfordns.js') }; @@ -112,22 +111,3 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { }); } -function getChangeStatus(dnsConfig, changeId, callback) { - assert.strictEqual(typeof dnsConfig, 'object'); - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - if (changeId === '') return callback(null, 'INSYNC'); - - superagent - .get(config.apiServerOrigin() + '/api/v1/domains/' + config.fqdn() + '/status/' + changeId) - .query({ token: dnsConfig.token }) - .timeout(30 * 1000) - .end(function (error, result) { - if (error && !error.response) return callback(error); - if (result.statusCode !== 200) return callback(new SubdomainError(SubdomainError.EXTERNAL_ERROR, util.format('%s %j', result.statusCode, result.body))); - - return callback(null, result.body.status); - }); - -} diff --git a/src/dns/digitalocean.js b/src/dns/digitalocean.js index bed6a73f7..b1d6cb3f4 100644 --- a/src/dns/digitalocean.js +++ b/src/dns/digitalocean.js @@ -4,7 +4,6 @@ exports = module.exports = { upsert: upsert, get: get, del: del, - getChangeStatus: getChangeStatus, waitForDns: require('./waitfordns.js') }; @@ -172,11 +171,3 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { }); } -function getChangeStatus(dnsConfig, changeId, callback) { - assert.strictEqual(typeof dnsConfig, 'object'); - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // Digitalocean does not have any way to check that - callback(null, 'INSYNC'); -} diff --git a/src/dns/interface.js b/src/dns/interface.js index 404b9082e..eb1a8d119 100644 --- a/src/dns/interface.js +++ b/src/dns/interface.js @@ -10,7 +10,6 @@ exports = module.exports = { upsert: upsert, get: get, del: del, - getChangeStatus: getChangeStatus, waitForDns: require('./waitfordns.js') }; @@ -56,12 +55,3 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { callback(new Error('not implemented')); } -function getChangeStatus(dnsConfig, changeId, callback) { - assert.strictEqual(typeof dnsConfig, 'object'); - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // Result: current change state as string. Upstream code checks for 'INSYNC' - - callback(new Error('not implemented')); -} diff --git a/src/dns/noop.js b/src/dns/noop.js index 1a654bba3..03f3cd467 100644 --- a/src/dns/noop.js +++ b/src/dns/noop.js @@ -4,7 +4,6 @@ exports = module.exports = { upsert: upsert, get: get, del: del, - getChangeStatus: getChangeStatus, waitForDns: require('./waitfordns.js') }; @@ -48,10 +47,3 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { return callback(); } -function getChangeStatus(dnsConfig, changeId, callback) { - assert.strictEqual(typeof dnsConfig, 'object'); - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - callback(null, 'INSYNC'); -} diff --git a/src/dns/route53.js b/src/dns/route53.js index 41194be42..525a82a1c 100644 --- a/src/dns/route53.js +++ b/src/dns/route53.js @@ -4,7 +4,6 @@ exports = module.exports = { upsert: upsert, get: get, del: del, - getChangeStatus: getChangeStatus, waitForDns: require('./waitfordns.js'), // not part of "dns" interface @@ -210,19 +209,3 @@ function del(dnsConfig, zoneName, subdomain, type, values, callback) { }); } -function getChangeStatus(dnsConfig, changeId, callback) { - assert.strictEqual(typeof dnsConfig, 'object'); - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - if (changeId === '') return callback(null, 'INSYNC'); - - var route53 = new AWS.Route53(getDnsCredentials(dnsConfig)); - route53.getChange({ Id: changeId }, function (error, result) { - if (error && error.code === 'AccessDenied') return callback(new SubdomainError(SubdomainError.ACCESS_DENIED, error.message)); - if (error) return callback(error); - - callback(null, result.ChangeInfo.Status); - }); -} - diff --git a/src/subdomains.js b/src/subdomains.js index bdd028a24..57af5e4dc 100644 --- a/src/subdomains.js +++ b/src/subdomains.js @@ -2,7 +2,6 @@ module.exports = exports = { remove: remove, - status: status, upsert: upsert, get: get, waitForDns: waitForDns, @@ -120,16 +119,3 @@ function waitForDns(domain, value, type, options, callback) { }); } -function status(changeId, callback) { - assert.strictEqual(typeof changeId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - settings.getDnsConfig(function (error, dnsConfig) { - if (error) return callback(new SubdomainError(SubdomainError.INTERNAL_ERROR, error)); - - api(dnsConfig.provider).getChangeStatus(dnsConfig, changeId, function (error, status) { - if (error) return callback(new SubdomainError(SubdomainError.EXTERNAL_ERROR, error.message)); - callback(null, status === 'INSYNC' ? 'done' : 'pending'); - }); - }); -} diff --git a/src/test/dns-test.js b/src/test/dns-test.js index 2aab04031..4a4704f82 100644 --- a/src/test/dns-test.js +++ b/src/test/dns-test.js @@ -61,15 +61,6 @@ describe('dns provider', function () { done(); }); }); - - it('status succeeds', function (done) { - subdomains.status('noop-record-id', function (error, result) { - expect(error).to.eql(null); - expect(result).to.eql('done'); - - done(); - }); - }); }); describe('digitalocean', function () { @@ -329,16 +320,6 @@ describe('dns provider', function () { done(); }); }); - - it('status succeeds', function (done) { - // actually not implemented in the backend - subdomains.status('unused', function (error, result) { - expect(error).to.eql(null); - expect(result).to.eql('done'); - - done(); - }); - }); }); describe('route53', function () { @@ -516,41 +497,5 @@ describe('dns provider', function () { done(); }); }); - - it('status succeeds for pending', function (done) { - awsAnswerQueue.push([null, { - ChangeInfo: { - Id: '/change/C2QLKQIWEI0BZF', - Status: 'PENDING', - SubmittedAt: 'Mon Aug 04 2014 17: 44: 49 GMT - 0700(PDT)' - } - }]); - - subdomains.status('/change/C2QLKQIWEI0BZF', function (error, result) { - expect(error).to.eql(null); - expect(result).to.eql('pending'); - expect(awsAnswerQueue.length).to.eql(0); - - done(); - }); - }); - - it('status succeeds for done', function (done) { - awsAnswerQueue.push([null, { - ChangeInfo: { - Id: '/change/C2QLKQIWEI0BZF', - Status: 'INSYNC', - SubmittedAt: 'Mon Aug 04 2014 17: 44: 49 GMT - 0700(PDT)' - } - }]); - - subdomains.status('/change/C2QLKQIWEI0BZF', function (error, result) { - expect(error).to.eql(null); - expect(result).to.eql('done'); - expect(awsAnswerQueue.length).to.eql(0); - - done(); - }); - }); }); });