From a2abb973c4c0dc0bd5ff6a45dc0ca922d376b089 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 11 Jan 2024 10:57:13 -0800 Subject: [PATCH] test run + fixups --- Cargo.lock | 1 + dev-tools/omdb/Cargo.toml | 1 + dev-tools/omdb/src/bin/omdb/nexus.rs | 20 ++++++++++++++------ openapi/nexus-internal.json | 12 ++++++++---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f12855d6b..1bc0f89f95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4904,6 +4904,7 @@ dependencies = [ "serde_json", "sled-agent-client", "slog", + "slog-error-chain", "strum", "subprocess", "tabled", diff --git a/dev-tools/omdb/Cargo.toml b/dev-tools/omdb/Cargo.toml index 7544374906..e08d5f9477 100644 --- a/dev-tools/omdb/Cargo.toml +++ b/dev-tools/omdb/Cargo.toml @@ -33,6 +33,7 @@ serde.workspace = true serde_json.workspace = true sled-agent-client.workspace = true slog.workspace = true +slog-error-chain.workspace = true strum.workspace = true tabled.workspace = true textwrap.workspace = true diff --git a/dev-tools/omdb/src/bin/omdb/nexus.rs b/dev-tools/omdb/src/bin/omdb/nexus.rs index f1e52471ef..ce9ddde922 100644 --- a/dev-tools/omdb/src/bin/omdb/nexus.rs +++ b/dev-tools/omdb/src/bin/omdb/nexus.rs @@ -17,6 +17,7 @@ use nexus_client::types::BackgroundTask; use nexus_client::types::CurrentStatus; use nexus_client::types::LastResult; use serde::Deserialize; +use slog_error_chain::InlineErrorChain; use std::collections::BTreeMap; use tabled::Tabled; use uuid::Uuid; @@ -694,12 +695,19 @@ async fn cmd_nexus_blueprints_list( time_created: String, } - let target_id = client - .blueprint_target_view() - .await - .context("fetching current target blueprint")? - .into_inner() - .target_id; + let target_id = match client.blueprint_target_view().await { + Ok(result) => Some(result.into_inner().target_id), + Err(error) => { + // This request will fail if there's no target configured, so it's + // not necessarily a big deal. + eprintln!( + "warn: failed to fetch current target: {}", + InlineErrorChain::new(&error), + ); + None + } + }; + let rows: Vec = client .blueprint_list_stream(None, None) .try_collect::>() diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index f0aa64b8e7..4604813804 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -2069,6 +2069,7 @@ ] }, "Blueprint": { + "description": "Describes all automatically-managed software and configuration in the rack", "type": "object", "properties": { "creator": { @@ -2092,7 +2093,7 @@ "reason": { "type": "string" }, - "sleds": { + "sleds_in_cluster": { "type": "array", "items": { "type": "string", @@ -2118,7 +2119,7 @@ "id", "omicron_zones", "reason", - "sleds", + "sleds_in_cluster", "time_created", "zones_in_service" ] @@ -2149,21 +2150,24 @@ "type": "object", "properties": { "enabled": { + "description": "policy: should the system actively work towards this blueprint\n\nThis should generally be left enabled.", "type": "boolean" }, "set_at": { + "description": "when this blueprint was made the target", "type": "string", "format": "date-time" }, "target_id": { - "nullable": true, + "description": "id of the blueprint that the system is trying to make real", "type": "string", "format": "uuid" } }, "required": [ "enabled", - "set_at" + "set_at", + "target_id" ] }, "BlueprintTargetSet": {