From 420ee1021195540eadd7c3348956c37ba2973e2d Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Sat, 4 Oct 2025 23:59:14 -0700 Subject: [PATCH] tweaks --- Cargo.lock | 1 + bin/core/src/monitor/mod.rs | 6 +- bin/core/src/resource/server.rs | 26 +---- .../src/components/resources/server/index.tsx | 97 +++++++++---------- lib/noise/Cargo.toml | 1 + lib/noise/src/key/private.rs | 1 + lib/noise/src/key/public.rs | 1 + 7 files changed, 57 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81697d2bf..4952875ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3302,6 +3302,7 @@ dependencies = [ "serde_json", "snow", "spki", + "tracing", ] [[package]] diff --git a/bin/core/src/monitor/mod.rs b/bin/core/src/monitor/mod.rs index 17abb8470..46dae91b6 100644 --- a/bin/core/src/monitor/mod.rs +++ b/bin/core/src/monitor/mod.rs @@ -28,7 +28,10 @@ use crate::{ config::core_config, helpers::periphery_client, monitor::{alert::check_alerts, record::record_server_stats}, - state::{db_client, deployment_status_cache, repo_status_cache}, + state::{ + db_client, deployment_status_cache, periphery_connections, + repo_status_cache, + }, }; use self::helpers::{ @@ -174,6 +177,7 @@ pub async fn update_cache_for_server(server: &Server, force: bool) { None, ) .await; + periphery_connections().remove(&server.id).await; return; } diff --git a/bin/core/src/resource/server.rs b/bin/core/src/resource/server.rs index 0792b6acf..aefe039dc 100644 --- a/bin/core/src/resource/server.rs +++ b/bin/core/src/resource/server.rs @@ -1,6 +1,5 @@ use anyhow::Context; use database::mungos::mongodb::{Collection, bson::doc}; -use formatting::format_serror; use indexmap::IndexSet; use komodo_client::entities::{ Operation, ResourceTarget, ResourceTargetVariant, komodo_timestamp, @@ -18,9 +17,7 @@ use komodo_client::entities::{ use crate::{ config::core_config, - connection::PeripheryConnectionArgs, monitor::update_cache_for_server, - periphery::PeripheryClient, state::{ action_states, db_client, periphery_connections, server_status_cache, @@ -164,29 +161,8 @@ impl super::KomodoResource for Server { async fn post_update( updated: &Self, - update: &mut Update, + _update: &mut Update, ) -> anyhow::Result<()> { - if updated.config.enabled { - // Init periphery client to trigger reconnection - // if relevant parameters change. - if let Err(e) = PeripheryClient::new( - PeripheryConnectionArgs::from_server(updated), - &updated.config.passkey, - ) - .await - .with_context(|| { - format!( - "Failed to get client handle after update for Server {}", - updated.id - ) - }) { - warn!("{e:#}"); - update - .push_simple_log("Post Update", format_serror(&e.into())); - }; - } else { - periphery_connections().remove(&updated.id).await; - } update_cache_for_server(updated, true).await; Ok(()) } diff --git a/frontend/src/components/resources/server/index.tsx b/frontend/src/components/resources/server/index.tsx index 8fd0e5288..b7a1d8816 100644 --- a/frontend/src/components/resources/server/index.tsx +++ b/frontend/src/components/resources/server/index.tsx @@ -55,7 +55,6 @@ import { HoverCard, HoverCardContent, HoverCardTrigger } from "@ui/hover-card"; import { Dialog, DialogContent, - DialogDescription, DialogFooter, DialogHeader, DialogTitle, @@ -435,56 +434,54 @@ export const ServerComponents: RequiredResourceComponents = { if (!server?.info.attempted_public_key) return null; return ( - - - - - -
- Invalid Pubkey -
-
-
- - - Confirm {server.name} public key? - - Public Key: {server.info.attempted_public_key} - - -
- - - -
-
-
- -
- Core failed to validate Periphery public key. - {canWrite ? " Click to validate." : ""} + + + +
+ Invalid Pubkey +
+
+
+ + + Confirm {server.name} public key? + +
+
+ Public Key: {server.info.attempted_public_key} +
+ {!server.info.address && ( +
Note. May take a few moments for status to update.
+ )}
- - + + + +
+
); }, }, diff --git a/lib/noise/Cargo.toml b/lib/noise/Cargo.toml index 4e218c3f6..6f181fe73 100644 --- a/lib/noise/Cargo.toml +++ b/lib/noise/Cargo.toml @@ -13,6 +13,7 @@ komodo_client.workspace = true pem-rfc7468.workspace = true serde_json.workspace = true colored.workspace = true +tracing.workspace = true anyhow.workspace = true base64.workspace = true pkcs8.workspace = true diff --git a/lib/noise/src/key/private.rs b/lib/noise/src/key/private.rs index 8ffc4b850..e00b5dd4f 100644 --- a/lib/noise/src/key/private.rs +++ b/lib/noise/src/key/private.rs @@ -47,6 +47,7 @@ impl Pkcs8PrivateKey { path: P, ) -> anyhow::Result<()> { let path = path.as_ref(); + tracing::info!("Writing private key to {path:?}"); std::fs::write(path, self.as_pem()).with_context(|| { format!("Failed to write private key pem to {path:?}") }) diff --git a/lib/noise/src/key/public.rs b/lib/noise/src/key/public.rs index ab0926360..39208b32e 100644 --- a/lib/noise/src/key/public.rs +++ b/lib/noise/src/key/public.rs @@ -48,6 +48,7 @@ impl SpkiPublicKey { path: P, ) -> anyhow::Result<()> { let path = path.as_ref(); + tracing::info!("Writing public key to {path:?}"); std::fs::write(path, self.as_pem()).with_context(|| { format!("Failed to write private key pem to {path:?}") })