From f313a37c9ca372c48d144799199851fd4e11fc00 Mon Sep 17 00:00:00 2001 From: Cheick Keita Date: Thu, 20 Oct 2022 15:18:35 -0700 Subject: [PATCH] Ignoring the scanning log file when reporting an issue with azcopy (#2536) * Ignoring the scanning log file when reporting an issue with azcopy * fix comment --- src/agent/onefuzz/src/az_copy.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/agent/onefuzz/src/az_copy.rs b/src/agent/onefuzz/src/az_copy.rs index 309faa1dd3..06f6efd259 100644 --- a/src/agent/onefuzz/src/az_copy.rs +++ b/src/agent/onefuzz/src/az_copy.rs @@ -49,14 +49,19 @@ impl fmt::Display for Mode { // caller, rather than the default AZCOPY log location. async fn read_azcopy_log_file(path: &Path) -> Result { let mut entries = fs::read_dir(path).await?; - // there should be only up to one file in azcopy_log dir - if let Some(file) = entries.next_entry().await? { - fs::read_to_string(file.path()) + // There should 2 files in azcopy_log dir, one is the log file, + // the other is scanning log file (added in 10.9.0) + while let Some(file) = entries.next_entry().await? { + if file.path().to_string_lossy().contains("scanning") { + continue; + } + + return fs::read_to_string(file.path()) .await - .with_context(|| format!("unable to read file: {}", file.path().display())) - } else { - bail!("no log file in path: {}", path.display()); + .with_context(|| format!("unable to read file: {}", file.path().display())); } + + bail!("no log file in path: {}", path.display()); } // attempt to redact an azcopy argument if it could possibly be a SAS URL