From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 878181FF13B for ; Wed, 20 May 2026 15:13:59 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 636D67E52; Wed, 20 May 2026 15:13:59 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager 3/3] clippy: sdn-client: fix 'large size difference between variants' for error type Date: Wed, 20 May 2026 15:13:47 +0200 Message-ID: <20260520131348.332987-4-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260520131348.332987-1-l.wagner@proxmox.com> References: <20260520131348.332987-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779282815248 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: CMLYTTBA6GTMFQNK75OF3APOBVK7DHG5 X-Message-ID-Hash: CMLYTTBA6GTMFQNK75OF3APOBVK7DHG5 X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Lukas Wagner --- Notes: Not sure if we should just add an ignore instead server/src/sdn_client.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/server/src/sdn_client.rs b/server/src/sdn_client.rs index 95e4d69b..f56519a6 100644 --- a/server/src/sdn_client.rs +++ b/server/src/sdn_client.rs @@ -2,7 +2,7 @@ use std::error::Error as StdError; use std::sync::Arc; use std::time::Duration; -use anyhow::{self, bail, Context}; +use anyhow::{self, bail, format_err, Context}; use futures::{future::join_all, stream::FuturesUnordered, StreamExt, TryFutureExt}; use pdm_api_types::{remotes::Remote, RemoteUpid}; @@ -25,7 +25,7 @@ pub struct LockedSdnClient { #[derive(Debug)] pub enum LockedSdnClientError { - Client(proxmox_client::Error), + Client(Box), Other(anyhow::Error), } @@ -49,7 +49,7 @@ impl std::fmt::Display for LockedSdnClientError { impl From for LockedSdnClientError { fn from(value: proxmox_client::Error) -> Self { - Self::Client(value) + Self::Client(Box::new(value)) } } @@ -219,15 +219,20 @@ impl LockedSdnClients { } } - return match &error { - LockedSdnClientError::Client(proxmox_client::Error::Api(status, _msg)) - if *status == 501 => - { - bail!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id) + return match error { + LockedSdnClientError::Client(error) => match *error { + proxmox_client::Error::Api(status_code, _msg) if status_code == 501 => { + Err(format_err!("remote {} does not support the sdn locking api, please upgrade to PVE 9 or newer!", remote.id)) + } + _ => Err(error).with_context(|| format!( + "could not lock sdn configuration for remote {}", + remote.id + )), } - _ => Err(error).with_context(|| { - format!("could not lock sdn configuration for remote {}", remote.id) - }), + _ => Err(error).with_context(|| format!( + "could not lock sdn configuration for remote {}", + remote.id + )), }; } }; -- 2.47.3