From f1a832f445c9994d9729a6fa1862b8d4a123bd31 Mon Sep 17 00:00:00 2001 From: clerie <git@clerie.de> Date: Thu, 8 May 2025 21:41:37 +0200 Subject: [PATCH] Give HTTP not found when not figuring out prometheus metric --- src/bin/nixos-validator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/nixos-validator.rs b/src/bin/nixos-validator.rs index ae3435e..0bbfc2b 100644 --- a/src/bin/nixos-validator.rs +++ b/src/bin/nixos-validator.rs @@ -128,7 +128,7 @@ async fn check(State(app_state): State<AppState>, Query(params): Query<HashMap<S .map_err(|_err| (StatusCode::INTERNAL_SERVER_ERROR, "Invalid response from Prometheus"))?; let current_system_hash = prometheus_body["data"]["result"][0]["metric"]["hash"].as_str() - .ok_or_else(|| (StatusCode::INTERNAL_SERVER_ERROR, "No current metric found in Prometheus"))?; + .ok_or_else(|| (StatusCode::NOT_FOUND, "No current metric found in Prometheus"))?; let hydra_req = client.get(format!("{}/job/{}/latest", app_state.hydra_url, app_state.hydra_job_template.clone().replace("{}", target))) .header("Accept", "application/json")