Add new options to delete-bucket command

Aperta
#843 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@metadaddy ci sta già lavorando.

Dal 17/12/2022.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Python
Stelle
638
Fork
138
Merge medio
8h 27m
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Backblaze/B2_Command_Line_Tool

Tutte le issue di Backblaze/B2_Command_Line_Tool

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.