mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-21 06:02:04 -04:00
Fix and improve test docker host
This commit is contained in:
parent
1062e629c5
commit
f3322398e5
2 changed files with 35 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
const { sendDockerHostList } = require("../client");
|
||||
const { checkLogin } = require("../util-server");
|
||||
const { DockerHost } = require("../docker");
|
||||
const { log } = require("../../src/util");
|
||||
|
||||
/**
|
||||
* Handlers for docker hosts
|
||||
|
@ -52,15 +53,22 @@ module.exports.dockerSocketHandler = (socket) => {
|
|||
try {
|
||||
checkLogin(socket);
|
||||
|
||||
let amount = await DockerHost.getAmountContainer(dockerHost);
|
||||
let amount = await DockerHost.testDockerHost(dockerHost);
|
||||
let msg;
|
||||
|
||||
if (amount > 1) {
|
||||
msg = "Connected Successfully. Amount of containers: " + amount;
|
||||
} else {
|
||||
msg = "Connected Successfully, but there are no containers?";
|
||||
}
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
msg: "Amount of containers: " + amount,
|
||||
msg,
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
log.error("docker", e);
|
||||
|
||||
callback({
|
||||
ok: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue