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 (#5001)
  • Loading branch information
marktheunissen authored Aug 13, 2024
1 parent 32b7b72 commit 21ab58a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 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: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ require (
github.com/minio/cli v1.24.2
github.com/minio/colorjson v1.0.8
github.com/minio/filepath v1.0.0
github.com/minio/madmin-go/v3 v3.0.58
github.com/minio/madmin-go/v3 v3.0.60
github.com/minio/minio-go/v7 v7.0.73
github.com/minio/pkg/v3 v3.0.3
github.com/minio/pkg/v3 v3.0.10
github.com/minio/selfupdate v0.6.0
github.com/mitchellh/go-homedir v1.1.0
github.com/muesli/reflow v0.3.0
Expand Down Expand Up @@ -118,4 +118,5 @@ 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
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ 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/madmin-go/v3 v3.0.60 h1:Vy9t7Mti22EcqqQyYRcvtLJmluaA3VINhBzaDBsT8h8=
github.com/minio/madmin-go/v3 v3.0.60/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/pkg/v3 v3.0.10 h1:pYcMsmwlMyYRo+XX+7vlLSp+5PqjwBk0SyFAeFlS81E=
github.com/minio/pkg/v3 v3.0.10/go.mod h1:QfWcz9jh3Qu0Xg1mVBKhBzIKj7hKB7vz61/9pR4ZZ9Q=
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 21ab58a

Please sign in to comment.