Address review of host pairing

Revoking a host now unassigns its instances instead of being refused
while it has any, and removes its system metrics.

Approving and revoking no longer force a save. Hosts are saved by
autosave and on exit like everything else, which also removes the
approving state from pairing requests.

The approval code and link are logged as warnings so they show up in
the systemd service, which only prints warnings and above. The pairing
limits are now the controller.host_pairing_timeout and
controller.host_pairing_max_pending config values, 0 removes the limit.

Subscribers take an optional permitted function, used for the pairing
requests instead of overrides in a subclass.
This commit is contained in:
Danielv123 committed 2026-10-31 16:31:45 +01:00
1 parent e5701a8dae
commit 49a0b27d29
29 files changed
+356 -418

No files matched your search

+9 -2
View File
@@ -179,7 +179,6 @@ describe("create installer CLI", function() {
it("writes the host config and leaves joining the cluster to the host", async function() {
const { stdout } = await run(hostArgs());
assert.match(stdout, /Successfully installed host/);
assert.match(stdout, /Start the host with run-host/);
const recorded = await commands();
assert.match(recorded[0], /^npm(?:\.cmd)? install @clusterio\/host$/);
@@ -208,7 +207,6 @@ describe("create installer CLI", function() {
"--factorio-dir", "factorio", "--remote-npm", "--plugins",
]);
assert.match(stdout, /Successfully installed standalone/);
assert.match(stdout, /Start the host with run-host/);
const recorded = await commands();
for (const expected of [
@@ -225,5 +223,14 @@ describe("create installer CLI", function() {
}
assert(!recorded.some(command => command.includes("host.controller_token")));
});
it("uses the host name given for a standalone install", async function() {
await fs.writeFile(path.join(directory, "config-controller.json"), "{}");
await run([
"--mode", "standalone", "--admin", "admin", "--http-port", "8123", "--public-address", "localhost",
"--factorio-dir", "factorio", "--remote-npm", "--plugins", "--host-name", "Test Host",
]);
assert((await commands()).includes(hostSet("host.name", "Test Host")));
});
});
});