From 050439ee14a3e06918ce1767ba9ca07107caef87 Mon Sep 17 00:00:00 2001 From: Draco-Lunaris-Echo Date: Fri, 5 Jun 2026 22:52:59 -0500 Subject: [PATCH] fix: add missing CRL columns to Host SQL queries and fix comma syntax Co-authored-by: Draco Lunaris <331325+Draco-Lunaris@users.noreply.github.com> --- Cargo.lock | 16 ++++++++-------- crates/pm-web/src/routes/enrollment.rs | 2 +- crates/pm-web/src/routes/hosts.rs | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edfdfae..88348e0 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -2043,7 +2043,7 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "migrate-secrets" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "hex", @@ -2548,7 +2548,7 @@ dependencies = [ [[package]] name = "pm-agent-client" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "chrono", @@ -2565,7 +2565,7 @@ dependencies = [ [[package]] name = "pm-auth" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "argon2", @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "pm-ca" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "chrono", @@ -2617,7 +2617,7 @@ dependencies = [ [[package]] name = "pm-core" -version = "0.1.9" +version = "0.2.2" dependencies = [ "aes-gcm", "anyhow", @@ -2641,7 +2641,7 @@ dependencies = [ [[package]] name = "pm-reports" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "chrono", @@ -2661,7 +2661,7 @@ dependencies = [ [[package]] name = "pm-web" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "axum", @@ -2702,7 +2702,7 @@ dependencies = [ [[package]] name = "pm-worker" -version = "0.1.9" +version = "0.2.2" dependencies = [ "anyhow", "chrono", diff --git a/crates/pm-web/src/routes/enrollment.rs b/crates/pm-web/src/routes/enrollment.rs index c9b69df..2506536 100644 --- a/crates/pm-web/src/routes/enrollment.rs +++ b/crates/pm-web/src/routes/enrollment.rs @@ -186,7 +186,7 @@ async fn approve_enrollment( // Check for FQDN/IP collision in hosts table if let Some(existing_host) = sqlx::query_as::<_, Host>( - "SELECT id, fqdn, ip_address::text, display_name, os_family, os_name, arch, agent_version, health_status, last_health_at, last_patch_at, agent_port, notes, registered_at, updated_at FROM hosts WHERE fqdn = $1 OR ip_address = $2::inet" + "SELECT id, fqdn, ip_address::text, display_name, os_family, os_name, arch, agent_version, health_status, last_health_at, last_patch_at, agent_port, notes, registered_at, updated_at, crl_status, crl_age_seconds, crl_next_update FROM hosts WHERE fqdn = $1 OR ip_address = $2::inet" ) .bind(&enrollment_request.fqdn) .bind(enrollment_request.ip_address.to_string()) diff --git a/crates/pm-web/src/routes/hosts.rs b/crates/pm-web/src/routes/hosts.rs index bb13de1..b302342 100644 --- a/crates/pm-web/src/routes/hosts.rs +++ b/crates/pm-web/src/routes/hosts.rs @@ -132,7 +132,7 @@ async fn list_hosts( THEN 'some_unhealthy' ELSE 'all_healthy' END AS health_check_status, - h.registered_at + h.registered_at, h.crl_status FROM hosts h LEFT JOIN host_patch_data hpd ON hpd.host_id = h.id @@ -166,7 +166,7 @@ async fn list_hosts( THEN 'some_unhealthy' ELSE 'all_healthy' END AS health_check_status, - h.registered_at + h.registered_at, h.crl_status FROM hosts h LEFT JOIN host_patch_data hpd ON hpd.host_id = h.id @@ -434,7 +434,7 @@ async fn update_host( SELECT id, fqdn, host(ip_address)::text AS ip_address, display_name, os_family, os_name, arch, agent_version, health_status, last_health_at, last_patch_at, agent_port, notes, - registered_at, updated_at + registered_at, updated_at, crl_status, crl_age_seconds, crl_next_update FROM hosts WHERE id = (SELECT id FROM updated) ) h "#,