Export CSV on every table, edit recurring maintenance, runs-on nothing, and run package checks outside the agent sandbox
- Export CSV for the small tables that had none (reads the table as shown) - Servers page shows a skeleton while loading instead of "No servers registered yet" - Recurring maintenance schedules can be edited (PUT /schedules/:id) - A server can be set to run on nothing (servers.no_parent, migration 0028) - Linux agent v3: package-manager question runs in ExecStartPre=-+ outside the sandbox, with --prepare-updates and --check-updates modes - Docs: README, DATABASE, AGENT_UPDATE Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c17e9aa140
commit
540ab704b7
32 files changed
+3003
-66
No files matched your search
@@ -358,6 +358,14 @@ describe("Linux agent", () => {
|
||||
// The two intended expansions, and nothing else turned into something unexpected.
|
||||
assert.equal(settings.get("EnvironmentFile"), "/etc/homelab-manager-agent.env");
|
||||
assert.equal(settings.get("ExecStart"), "/usr/local/bin/homelab-manager-agent.sh");
|
||||
|
||||
// The one step that runs outside the sandbox (+) is the package-manager question, which may fail without stopping the report (-),
|
||||
// and it hands its answer over through the unit's own private directory, which is where the script looks for it.
|
||||
assert.equal(settings.get("ExecStartPre"), "-+/usr/local/bin/homelab-manager-agent.sh --prepare-updates");
|
||||
assert.equal(rendered.split("\n").filter((l) => /^ExecStartPre=/.test(l.trim())).length, 1, "only that one step is outside the sandbox");
|
||||
assert.equal(settings.get("RuntimeDirectory"), "homelab-manager-agent");
|
||||
assert.equal(settings.get("RuntimeDirectoryMode"), "0700");
|
||||
assert.ok(readFileSync(agentScript, "utf8").includes("/run/homelab-manager-agent/updates.json"), "the script looks where the unit leaves it");
|
||||
assert.doesNotMatch(rendered, /[`\\]/);
|
||||
|
||||
for (const [key, value] of Object.entries({
|
||||
@@ -389,6 +397,18 @@ describe("Linux agent", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("the update check can be run on its own, and what it leaves behind is read back through jq, not trusted", () => {
|
||||
const text = readFileSync(agentScript, "utf8");
|
||||
assert.ok(text.includes("--prepare-updates) MODE=prepare"));
|
||||
assert.ok(text.includes("--check-updates) MODE=check"));
|
||||
assert.ok(text.includes("use_prepared_updates || collect_updates"), "the report uses the prepared answer first and asks itself otherwise");
|
||||
assert.ok(text.includes('find "$UPDATES_FILE" -mmin -10'), "an old answer isn't used");
|
||||
assert.ok(text.includes("jq -ce 'select(type == \"object\""), "the file is re-shaped by jq, so the report only carries the four known fields");
|
||||
assert.ok(text.includes('mv -f "$UPDATES_FILE.tmp" "$UPDATES_FILE"'), "written whole, then moved into place");
|
||||
// the two modes must not need a server address or a token
|
||||
assert.ok(text.includes('[[ "$MODE" == "report" && ( -z "$API_URL" || -z "$API_TOKEN" ) ]]'));
|
||||
});
|
||||
|
||||
test("unit files are made readable by everyone (the umask above them is for the token file)", () => {
|
||||
const text = readFileSync(installScript, "utf8").replace(/\r\n/g, "\n");
|
||||
assert.match(text, /chmod 644 "\$SYSTEMD_DIR\/homelab-manager-agent\.service" "\$SYSTEMD_DIR\/homelab-manager-agent\.timer"/);
|
||||
|
||||
Reference in new issue
Block a user