Skip to content

Commit

Permalink
Import bucket metadata must show CORS and general errors if any are f…
Browse files Browse the repository at this point in the history
…ound
  • Loading branch information
marktheunissen committed Jul 31, 2024
1 parent 8ad22bb commit 86994af
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
14 changes: 12 additions & 2 deletions cmd/admin-cluster-bucket-import.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ func (i importMetaMsg) String() string {
if st.ObjectLock.Err != "" || st.Versioning.Err != "" ||
st.SSEConfig.Err != "" || st.Tagging.Err != "" ||
st.Lifecycle.Err != "" || st.Quota.Err != "" ||
st.Policy.Err != "" || st.Notification.Err != "" {
st.Policy.Err != "" || st.Notification.Err != "" ||
st.Cors.Err != "" || st.Err != "" {
totErrs++
}
}
Expand All @@ -168,7 +169,8 @@ func (i importMetaMsg) String() string {
if st.ObjectLock.Err != "" || st.Versioning.Err != "" ||
st.SSEConfig.Err != "" || st.Tagging.Err != "" ||
st.Lifecycle.Err != "" || st.Quota.Err != "" ||
st.Policy.Err != "" || st.Notification.Err != "" {
st.Policy.Err != "" || st.Notification.Err != "" ||
st.Cors.Err != "" || st.Err != "" {
fmt.Fprintln(&b, printImportErrs(bucket, st))
}
}
Expand All @@ -194,6 +196,10 @@ func printImportErrs(bucket string, r madmin.BucketStatus) string {
key := fmt.Sprintf("%-10s: %s", "Name", bucket)
fmt.Fprintln(&b, console.Colorize("Name", key))

if r.Err != "" {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, console.Colorize("errors", "Error: "), r.Err)
fmt.Fprintln(&b)
}
if r.ObjectLock.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Object lock: ", statusTick(r.ObjectLock))
fmt.Fprintln(&b)
Expand Down Expand Up @@ -227,5 +233,9 @@ func printImportErrs(bucket string, r madmin.BucketStatus) string {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "Tagging: ", statusTick(r.Tagging))
fmt.Fprintln(&b)
}
if r.Cors.IsSet {
fmt.Fprintf(&b, "%2s%s %s", placeHolder, "CORS: ", statusTick(r.Cors))
fmt.Fprintln(&b)
}
return b.String()
}
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,9 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/minio/madmin-go/v3 => github.com/marktheunissen/madmin-go/v3 v3.0.0-20240730061730-2d8255671cb3

replace github.com/minio/pkg/v3 => github.com/marktheunissen/pkg/v3 v3.0.0-20240726014105-5a91ee390421
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae h1:dIZY4ULFcto4tAFlj1FYZl8ztUZ13bdq+PLY+NOfbyI=
github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k=
github.com/marktheunissen/madmin-go/v3 v3.0.0-20240730061730-2d8255671cb3 h1:3m57M9Lq3JauBsFqgpkPEIeDW4+EogeKr3bMT1zJfkM=
github.com/marktheunissen/madmin-go/v3 v3.0.0-20240730061730-2d8255671cb3/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw=
github.com/marktheunissen/pkg/v3 v3.0.0-20240726014105-5a91ee390421 h1:5UzjUfs6yp+zXFt9a+sd32pa2eo4uNWBrOmT2FYdejQ=
github.com/marktheunissen/pkg/v3 v3.0.0-20240726014105-5a91ee390421/go.mod h1:QfWcz9jh3Qu0Xg1mVBKhBzIKj7hKB7vz61/9pR4ZZ9Q=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
Expand All @@ -139,16 +143,12 @@ github.com/minio/colorjson v1.0.8 h1:AS6gEQ1dTRYHmC4xuoodPDRILHP/9Wz5wYUGDQfPLpg
github.com/minio/colorjson v1.0.8/go.mod h1:wrs39G/4kqNlGjwqHvPlAnXuc2tlPszo6JKdSBCLN8w=
github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY=
github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw=
github.com/minio/madmin-go/v3 v3.0.58 h1:CUhb6FsBvgPfP1iOWvMGqlrB1epYpJw0i/yGXPH12WQ=
github.com/minio/madmin-go/v3 v3.0.58/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.73 h1:qr2vi96Qm7kZ4v7LLebjte+MQh621fFWnv93p12htEo=
github.com/minio/minio-go/v7 v7.0.73/go.mod h1:qydcVzV8Hqtj1VtEocfxbmVFa2siu6HGa+LDEPogjD8=
github.com/minio/mux v1.9.0 h1:dWafQFyEfGhJvK6AwLOt83bIG5bxKxKJnKMCi0XAaoA=
github.com/minio/mux v1.9.0/go.mod h1:1pAare17ZRL5GpmNL+9YmqHoWnLmMZF9C/ioUCfy0BQ=
github.com/minio/pkg/v3 v3.0.3 h1:PUJVi5a6Hdn5mIhffC24koFMQwucvTyBHsIOjsisI+U=
github.com/minio/pkg/v3 v3.0.3/go.mod h1:53gkSUVHcfYoskOs5YAJ3D99nsd2SKru90rdE9whlXU=
github.com/minio/selfupdate v0.6.0 h1:i76PgT0K5xO9+hjzKcacQtO7+MjJ4JKA8Ak8XQ9DDwU=
github.com/minio/selfupdate v0.6.0/go.mod h1:bO02GTIPCMQFTEvE5h4DjYB58bCoZ35XLeBf0buTDdM=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
Expand Down

0 comments on commit 86994af

Please sign in to comment.