Vérifier existence de buckets avant de seed
Continue silencieusement si tout existe déjà
This commit is contained in:
parent
9bbeb4b7ee
commit
7accc596c7
1 changed files with 11 additions and 0 deletions
|
@ -181,6 +181,17 @@ func handleV1Seed(c echo.Context) error {
|
|||
var new_buckets []string
|
||||
|
||||
for _, bucket := range documents_buckets {
|
||||
exists, err := client.BucketExists(context.Background(), bucket)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, map[string]string{
|
||||
"message": "Error during minio#BucketExists",
|
||||
})
|
||||
}
|
||||
|
||||
if exists {
|
||||
continue
|
||||
}
|
||||
|
||||
if err = client.MakeBucket(context.Background(), bucket, minio.MakeBucketOptions{}); err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, map[string]string{
|
||||
"message": "Error during minio#MakeBucket",
|
||||
|
|
Loading…
Reference in a new issue