Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Ignoring the scanning log file when reporting an issue with azcopy (#…
Browse files Browse the repository at this point in the history
…2536)

* Ignoring the scanning log file when reporting an issue with azcopy

* fix comment
  • Loading branch information
chkeita authored Oct 20, 2022
1 parent e83a18b commit f313a37
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/agent/onefuzz/src/az_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
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
Expand Down

0 comments on commit f313a37

Please sign in to comment.