Add new options to delete-bucket command

Đang mở
#843 5 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@metadaddy đang làm issue này rồi.

Từ ngày 17/12/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Users sometimes need to delete a bucket and all the objects in that bucket. It is laborious to write a script to do so, and the use of b2 sync is not obvious. Add the following options to delete-bucket:

  • --recursive delete all file versions in the bucket, then delete the bucket itself. The user is prompted for confirmation, unless the --force option is supplied. The command prints the details of each file version (using the same format as the ls command) as it is deleted, unless the --quiet option is specified.
  • --force do not prompt for confirmation when doing a recursive delete.
  • --quiet do not print details of file versions as they are deleted.
  • --deleteKeys delete application keys scoped to this bucket, since they will be redundant.
  • --deleteReplications delete replication rules associated with this bucket.
  • --deleteAll abbreviation for --recursive --deleteKeys --deleteReplications

The following description is in terms of B2 Native API operations, though the command will call the equivalent methods in b2-sdk-python:

When recursive is specified, after the confirmation step, the command will call b2_list_file_versions on the bucket once, and loop through the results, calling b2_delete_file_version for each file version and, if -quiet was not specified, printing the details of the file version. If either b2_list_file_versions or b2_delete_file_version returns an error, the command will terminate, reporting that error.

Once the command has called b2_delete_file_version for each file version returned by b2_list_file_versions, it will call b2_delete_bucket to delete the bucket itself, reporting any error returned by that operation.

Note that b2_delete_bucket may fail due to the bucket not being empty, as files may be uploaded to the bucket after b2_list_file_versions was called. In this case, the command will call b2_list_file_versions again, accompanying the error message from b2_delete_bucket with the message One or more files were uploaded while the bucket contents were being deleted: and the results of the b2_list_file_versions call.

Ngôn ngữ chính
Python
Star
638
Fork
138
Merge trung bình
8 giờ 27 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Backblaze/B2_Command_Line_Tool

Tất cả issue của Backblaze/B2_Command_Line_Tool

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.