better debugs
This commit is contained in:
@@ -83,15 +83,16 @@ async function waitForDns(hostname, zoneName, type, value, options) {
|
|||||||
assert.strictEqual(typeof value, 'string');
|
assert.strictEqual(typeof value, 'string');
|
||||||
assert(options && typeof options === 'object'); // { interval: 5000, times: 50000 }
|
assert(options && typeof options === 'object'); // { interval: 5000, times: 50000 }
|
||||||
|
|
||||||
debug(`waitForDns: ${hostname} to be ${value} in zone ${zoneName}`);
|
debug(`waitForDns: waiting for ${hostname} to be ${value} in zone ${zoneName}`);
|
||||||
|
|
||||||
await promiseRetry(Object.assign({ debug }, options), async function () {
|
await promiseRetry(Object.assign({ debug }, options), async function () {
|
||||||
const nameservers = await dig.resolve(zoneName, 'NS', { timeout: 5000 });
|
const nameservers = await dig.resolve(zoneName, 'NS', { timeout: 5000 });
|
||||||
if (!nameservers) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Unable to get nameservers');
|
if (!nameservers) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Unable to get nameservers');
|
||||||
|
debug(`waitForDns: nameservers are ${JSON.stringify(nameservers)}`);
|
||||||
|
|
||||||
for (const nameserver of nameservers) {
|
for (const nameserver of nameservers) {
|
||||||
const synced = await isChangeSynced(hostname, type, value, nameserver);
|
const synced = await isChangeSynced(hostname, type, value, nameserver);
|
||||||
debug('waitForDns: %s %s ns: %j', hostname, synced ? 'done' : 'not done', nameservers);
|
debug(`waitForDns: ${hostname} at ns ${nameserver}: ${synced ? 'done' : 'not done'} `);
|
||||||
if (!synced) throw new BoxError(BoxError.EXTERNAL_ERROR, 'ETRYAGAIN');
|
if (!synced) throw new BoxError(BoxError.EXTERNAL_ERROR, 'ETRYAGAIN');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user