unbound: take into account dig resolve status
This commit is contained in:
+8
-1
@@ -38,6 +38,7 @@ const addonConfigs = require('./addonconfigs.js'),
|
||||
constants = require('./constants.js'),
|
||||
crypto = require('crypto'),
|
||||
debug = require('debug')('box:services'),
|
||||
dig = require('./dig.js'),
|
||||
docker = require('./docker.js'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
fs = require('fs'),
|
||||
@@ -1864,7 +1865,13 @@ async function restartDocker() {
|
||||
|
||||
async function statusUnbound() {
|
||||
const [error] = await safe(shell.promises.exec('statusUnbound', 'systemctl is-active unbound'));
|
||||
return { status: error ? exports.SERVICE_STATUS_STOPPED : exports.SERVICE_STATUS_ACTIVE };
|
||||
if (error) return { status: exports.SERVICE_STATUS_STOPPED };
|
||||
|
||||
const [digError, digResult] = await safe(dig.resolve('ipv4.api.cloudron.io', 'A', { server: '127.0.0.1', timeout: 10000 }));
|
||||
if (!digError && Array.isArray(digResult) && digResult.length !== 0) return { status: exports.SERVICE_STATUS_ACTIVE };
|
||||
|
||||
debug('statusUnbound: unbound is up, but failed to resolve ipv4.api.cloudron.io', digError, digResult);
|
||||
return { status: exports.SERVICE_STATUS_STARTING };
|
||||
}
|
||||
|
||||
async function restartUnbound() {
|
||||
|
||||
Reference in New Issue
Block a user