fix return appropriate error for MakeBucket in federation (#8878)

master
Harshavardhana 5 years ago committed by kannappanr
parent fe5d599802
commit b9c48e0ab0
  1. 4
      README.md
  2. 13
      cmd/bucket-handlers.go

@ -21,7 +21,7 @@ docker run -p 9000:9000 minio/minio:edge server /data
> NOTE: Docker will not display the default keys unless you start the container with the `-it`(interactive TTY) argument. Generally, it is not recommended to use default keys with containers. Please visit MinIO Docker quickstart guide for more information [here](https://docs.min.io/docs/minio-docker-quickstart-guide) > NOTE: Docker will not display the default keys unless you start the container with the `-it`(interactive TTY) argument. Generally, it is not recommended to use default keys with containers. Please visit MinIO Docker quickstart guide for more information [here](https://docs.min.io/docs/minio-docker-quickstart-guide)
## macOS ## macOS
### Homebrew ### Homebrew (recommended)
Install minio packages using [Homebrew](http://brew.sh/) Install minio packages using [Homebrew](http://brew.sh/)
```sh ```sh
brew install minio/stable/minio brew install minio/stable/minio
@ -74,7 +74,7 @@ minio.exe server D:\Photos
## FreeBSD ## FreeBSD
### Port ### Port
Install minio packages using [pkg](https://github.com/freebsd/pkg) Install minio packages using [pkg](https://github.com/freebsd/pkg), MinIO doesn't officially build FreeBSD binaries but is maintained by FreeBSD upstream [here](https://www.freshports.org/www/minio).
```sh ```sh
pkg install minio pkg install minio

@ -534,7 +534,8 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
} }
if globalDNSConfig != nil { if globalDNSConfig != nil {
if _, err := globalDNSConfig.Get(bucket); err != nil { sr, err := globalDNSConfig.Get(bucket)
if err != nil {
if err == dns.ErrNoEntriesFound { if err == dns.ErrNoEntriesFound {
// Proceed to creating a bucket. // Proceed to creating a bucket.
if err = objectAPI.MakeBucketWithLocation(ctx, bucket, location); err != nil { if err = objectAPI.MakeBucketWithLocation(ctx, bucket, location); err != nil {
@ -567,7 +568,15 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
return return
} }
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrBucketAlreadyOwnedByYou), r.URL, guessIsBrowserReq(r)) apiErr := ErrBucketAlreadyExists
if !globalDomainIPs.Intersection(set.CreateStringSet(getHostsSlice(sr)...)).IsEmpty() {
apiErr = ErrBucketAlreadyOwnedByYou
}
// No IPs seem to intersect, this means that bucket exists but has
// different IP addresses perhaps from a different deployment.
// bucket names are globally unique in federation at a given
// path prefix, name collision is not allowed. Return appropriate error.
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(apiErr), r.URL, guessIsBrowserReq(r))
return return
} }

Loading…
Cancel
Save