feat(devices): latest build tracking + update/reinstall actions with live-action guard #2
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hex/zeno-rmm!2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/device-build-and-reinstall"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds the build-tracking and reinstall primitives for the device detail page:
build" row, the device detail page now shows the build CI most recently
published for the device's OS (
latest_build_id/latest_build_published_atonDeviceSummary, both in the list andsingle-device API responses), with an "up to date" / "outdated" chip.
agent_outdated, so an operator can re-push the current build (e.g. torecover a corrupted install).
response includes the installer URL to re-run manually.
fresh one-time enrollment token (1h expiry, reuses
EnrollmentCode) isissued. Requires typing the device hostname to confirm.
POST /api/devices/{id}/update— 404 if no build is published forthe OS, 409
{ "error": "device_offline" }if the agent isn't connected,otherwise pushes
ServerMessage::Updateand returns{ "queued": true, "build_id": ... }. Audit-logged asdevice.update_agent.POST /api/devices/{id}/reinstall— requiresconfirm: true; sendsServerMessage::Uninstallif the agent is connected. Audit-logged asdevice.reinstall/device.reinstall_clean.Update/Uninstallto aconnected agent now additionally requires
ZENO_ALLOW_LIVE_AGENT_ACTIONS=1on the server and
confirm_live: truein the request body, returning403 { "error": "live_actions_disabled", "hint": ... }otherwise. Thiswas added after an earlier validation pass against this branch's endpoints
accidentally triggered a real self-update + uninstall on a live connected
agent (
Alonzo-PC, since re-enrolled).Tests
cargo test -p zeno-server— 52 passed, including new unit tests foris_agent_outdated,latest_published_build(mtime fallback forpublished_at),ReinstallRequestconfirm validation, enrollment-codeuniqueness/format, and the live-action guard's env-var + flag combinations.
node --test crates/zeno-server/tests/*.test.mjs— including newdevice_build_status.test.mjscovering the "Latest build on main"chip/text logic.
cargo build -p zeno-serverclean; Docker dev image rebuilt and thecontainer is healthy on port 8090.
agent actions were performed in this pass per the new guard).
Files changed
crates/zeno-server/src/agent_updates.rs—PublishedBuild.published_at(with mtime fallback) + tests
crates/zeno-server/src/api/devices.rs—latest_build_*fields,/updateand/reinstallendpoints, live-action guard, testscrates/zeno-server/src/api/mod.rs— route registration(
/devices/{id}/update,/devices/{id}/reinstall)crates/zeno-server/src/auth.rs— enrollment code uniqueness testcrates/zeno-server/src/db/models.rs—AuditEntry::recordcrates/zeno-server/src/web/templates.rs+templates/device_detail.html— "Latest build on main" row, always-onUpdate button, new Reinstall button
crates/zeno-server/src/web/static/js/device_detail.js— build-statusrendering (
ZenoDeviceBuild.buildStatus),/updatecall withconfirm_live: truecrates/zeno-server/src/web/static/js/device-reinstall.js— new reinstalldialog (standard vs. clean, hostname confirmation)
crates/zeno-server/tests/device_build_status.test.mjs— newcrates/zeno-server/Cargo.toml—tempfiledev-dependency