remove subdomains.status
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user