From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 55E3890D3D for ; Fri, 23 Sep 2022 12:34:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3A39E24122 for ; Fri, 23 Sep 2022 12:34:03 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 23 Sep 2022 12:34:02 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 39B8F444F7 for ; Fri, 23 Sep 2022 12:34:02 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Fri, 23 Sep 2022 12:33:52 +0200 Message-Id: <20220923103352.569770-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220923103352.569770-1-f.gruenbichler@proxmox.com> References: <20220923103352.569770-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.146 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: [pve-devel] [PATCH proxmox-offline-mirror 2/2] mirror: collect and summarize warnings X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2022 10:34:03 -0000 the output can get quite long and warnings can easily be missed otherwise. Signed-off-by: Fabian Grünbichler --- src/mirror.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mirror.rs b/src/mirror.rs index e655847..f8afd2b 100644 --- a/src/mirror.rs +++ b/src/mirror.rs @@ -494,6 +494,7 @@ pub fn create_snapshot( let prefix = Path::new(&prefix); let mut total_progress = Progress::new(); + let mut warnings = Vec::new(); let parse_release = |res: FetchResult, name: &str| -> Result { println!("Parsing {name}.."); @@ -624,10 +625,12 @@ pub fn create_snapshot( ) { Ok(res) => res, Err(err) if !reference.file_type.is_package_index() => { - eprintln!( + let msg = format!( "Failed to fetch '{:?}' type reference '{}', skipping - {err}", reference.file_type, reference.path ); + eprintln!("{msg}"); + warnings.push(msg); failed_references.push(reference); continue; } @@ -709,6 +712,7 @@ pub fn create_snapshot( basename, package.file, err, ); eprintln!("{msg}"); + warnings.push(msg); } res => { res?; @@ -735,8 +739,15 @@ pub fn create_snapshot( println!("\nStats: {total_progress}"); } + if !warnings.is_empty() { + eprintln!("Warnings:"); + for msg in warnings { + eprintln!("- {msg}"); + } + } + if !dry_run { - println!("Rotating temp. snapshot in-place: {prefix:?} -> \"{snapshot}\""); + println!("\nRotating temp. snapshot in-place: {prefix:?} -> \"{snapshot}\""); let locked = config.pool.lock()?; locked.rename(prefix, Path::new(&format!("{snapshot}")))?; } -- 2.30.2