fixed bug determining for which domains to set new DNS records
This commit is contained in:
parent
b4e967f152
commit
ef5dcb81f4
|
@ -108,7 +108,7 @@ module.exports.create = function (deps, conf) {
|
||||||
return record.value === addr && badAddrDomains.indexOf(record.host) < 0;
|
return record.value === addr && badAddrDomains.indexOf(record.host) < 0;
|
||||||
}).map(record => record.host);
|
}).map(record => record.host);
|
||||||
var requiredUpdates = domains.filter(function (domain) {
|
var requiredUpdates = domains.filter(function (domain) {
|
||||||
return goodAddrDomains.indexOf(domain) !== -1;
|
return goodAddrDomains.indexOf(domain) < 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
var oldDns = await splitDomains(directives.api, badAddrDomains);
|
var oldDns = await splitDomains(directives.api, badAddrDomains);
|
||||||
|
@ -120,6 +120,9 @@ module.exports.create = function (deps, conf) {
|
||||||
await deps.PromiseA.all(oldDns.map(function (record) {
|
await deps.PromiseA.all(oldDns.map(function (record) {
|
||||||
return deps.OAUTH3.api(directives.api, Object.assign({}, common, record));
|
return deps.OAUTH3.api(directives.api, Object.assign({}, common, record));
|
||||||
}));
|
}));
|
||||||
|
if (conf.debug && badAddrDomains.length) {
|
||||||
|
console.log('removed bad DNS records for ' + badAddrDomains.join(', '));
|
||||||
|
}
|
||||||
|
|
||||||
var newDns = await splitDomains(directives.api, requiredUpdates);
|
var newDns = await splitDomains(directives.api, requiredUpdates);
|
||||||
common = {
|
common = {
|
||||||
|
@ -132,6 +135,9 @@ module.exports.create = function (deps, conf) {
|
||||||
await deps.PromiseA.all(newDns.map(function (record) {
|
await deps.PromiseA.all(newDns.map(function (record) {
|
||||||
return deps.OAUTH3.api(directives.api, Object.assign({}, common, record));
|
return deps.OAUTH3.api(directives.api, Object.assign({}, common, record));
|
||||||
}));
|
}));
|
||||||
|
if (conf.debug && requiredUpdates.length) {
|
||||||
|
console.log('set new DNS records for ' + requiredUpdates.join(', '));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDeviceAddresses(session) {
|
async function getDeviceAddresses(session) {
|
||||||
|
|
Loading…
Reference in New Issue