minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

`mc rb --force minio/my-bucket` should be idempotent #4880

Closed binaryfire closed 5 months ago

binaryfire commented 7 months ago

Similar to https://github.com/minio/mc/issues/4863

In Linux, using the force flag when removing directories (rm -rf) doesn't throw an error if the directory doesn't exist. This is by design: -rf is the equivalent of saying "just make sure the directory doesn't exist". That allows it to be used idempotently in scripts.

Similarly I think the --force flag in mc rb --force minio/my bucket should make the command idempotent. Instead of exiting with an exit code of 1 and mc: <ERROR> Unable to validate target 'minio/my-bucket'. Bucket 'my-bucket' does not exist message, it would be better if the exit code was 0 and a simpler informational message like mc: Bucket 'my-bucket' does not exist was shown.