From 9c29375b63536a75def682a563c500319adfe863 Mon Sep 17 00:00:00 2001 From: Haitao Mei Date: Tue, 11 Jul 2023 05:39:01 -0700 Subject: [PATCH] new admin tool unlink refactoring Summary: This diff does the follow: * fix linter problems in the pre diffs in this stack * remove the directory creating for error log files, to prevent typos Reviewed By: mitrandir77 Differential Revision: D47228262 fbshipit-source-id: 5422ce01809100732070dafebf6dbda06ce5a872 --- .../integration/test-newadmin-blobstore-bulk-unlinking.t | 1 + .../tools/admin/src/commands/blobstore_bulk_unlink.rs | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/eden/mononoke/tests/integration/test-newadmin-blobstore-bulk-unlinking.t b/eden/mononoke/tests/integration/test-newadmin-blobstore-bulk-unlinking.t index 5bce398429..daccc33d6b 100644 --- a/eden/mononoke/tests/integration/test-newadmin-blobstore-bulk-unlinking.t +++ b/eden/mononoke/tests/integration/test-newadmin-blobstore-bulk-unlinking.t @@ -30,6 +30,7 @@ Check we can upload and fetch an arbitrary blob. Prepare the input directory for the bulk unlinking tool $ mkdir -p "$TESTTMP/key_inputs" + $ mkdir -p "$TESTTMP/unlink_log" Prepare the input file that only contains a bad-format key for the bulk unlinking tool $ echo some-invliad-key > "$TESTTMP/key_inputs/bad_format_key_file_0" diff --git a/eden/mononoke/tools/admin/src/commands/blobstore_bulk_unlink.rs b/eden/mononoke/tools/admin/src/commands/blobstore_bulk_unlink.rs index 7c0bbf3d44..d934f7d4c8 100644 --- a/eden/mononoke/tools/admin/src/commands/blobstore_bulk_unlink.rs +++ b/eden/mononoke/tools/admin/src/commands/blobstore_bulk_unlink.rs @@ -54,9 +54,6 @@ pub struct CommandArgs { } fn create_error_log_file(error_log_file_path: String) -> File { - let path = std::path::Path::new(&error_log_file_path); - let prefix = path.parent().unwrap(); - std::fs::create_dir_all(prefix).unwrap(); let file = OpenOptions::new() .create(true) .write(true) @@ -218,7 +215,7 @@ impl BlobstoreBulkUnlinker { "key": key, "message": msg }); - writeln!(&self.error_log_file, "{}", error_record.to_string()); + writeln!(&self.error_log_file, "{}", error_record); } async fn bulk_unlink_keys_in_file(