Private
Public Access
1
0

feat: populate os_family, os_name, arch, agent_version from health poller and enrollment
Some checks failed
CI Pipeline / Rust Format Check (push) Failing after 2s
CI Pipeline / Clippy Lints (push) Failing after 1s
CI Pipeline / Rust Unit Tests (push) Failing after 2s
CI Pipeline / Security Audit (push) Failing after 2s
CI Pipeline / Frontend Lint & Type Check (push) Failing after 3s
CI Pipeline / Build .deb & Release (push) Has been skipped

- health_poller: persist agent_version from HealthData.version
- health_poller: call /system/info to update os_family, os_name, arch
- enrollment: set os_family and arch from os_details during approval
- enrollment: build os_name from os+os_version when name field absent
- COALESCE in UPDATE preserves existing values when new data unavailable
- version bump 0.1.7 -> 0.1.8
This commit is contained in:
2026-05-21 00:09:57 +00:00
parent f70c5e53f9
commit 6c72dc3ac6
57 changed files with 119 additions and 42 deletions

0
crates/pm-web/src/main.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/auth.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/ca.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/discovery.rs Normal file → Executable file
View File

View File

@ -226,10 +226,33 @@ async fn approve_enrollment(
}
// Move to hosts table FIRST (certificates table has FK reference to hosts)
let os_family = enrollment_request
.os_details
.get("os")
.and_then(|v| v.as_str())
.map(|s| s.to_string());
let os_name = enrollment_request
.os_details
.get("name")
.and_then(|v| v.as_str())
.map(|s| s.to_string())
.or_else(|| {
// Build os_name from os + os_version if "name" is absent
let os = enrollment_request
.os_details
.get("os")
.and_then(|v| v.as_str())?;
let ver = enrollment_request
.os_details
.get("os_version")
.and_then(|v| v.as_str())
.unwrap_or("");
Some(format!("{} {}", os, ver).trim().to_string())
});
let arch = enrollment_request
.os_details
.get("architecture")
.and_then(|v| v.as_str())
.map(|s| s.to_string());
let display_name = enrollment_request
.hostname
@ -237,14 +260,16 @@ async fn approve_enrollment(
.unwrap_or_else(|| enrollment_request.fqdn.clone());
sqlx::query(
r#"
INSERT INTO hosts (id, fqdn, ip_address, os_name, display_name, registered_at, updated_at)
VALUES ($1, $2, $3::inet, $4, $5, NOW(), NOW())
INSERT INTO hosts (id, fqdn, ip_address, os_family, os_name, arch, display_name, registered_at, updated_at)
VALUES ($1, $2, $3::inet, $4, $5, $6, $7, NOW(), NOW())
"#,
)
.bind(enrollment_request.id)
.bind(&enrollment_request.fqdn)
.bind(enrollment_request.ip_address.to_string())
.bind(os_name)
.bind(&os_family)
.bind(&os_name)
.bind(&arch)
.bind(&display_name)
.execute(&state.db)
.await

0
crates/pm-web/src/routes/groups.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/health_checks.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/hosts.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/jobs.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/maintenance_windows.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/mod.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/reports.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/settings.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/sso.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/status.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/users.rs Normal file → Executable file
View File

0
crates/pm-web/src/routes/ws.rs Normal file → Executable file
View File