aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_s3_configure.go
diff options
context:
space:
mode:
authorguosj <515878133@qq.com>2022-07-13 17:28:20 +0800
committerguosj <515878133@qq.com>2022-07-13 17:28:20 +0800
commitab1b9697e6c1eabd3f097a6fc28caf40e73ba7ed (patch)
tree70cdc6624ef1a13099f4817d5c7c8ef5673dd0c3 /weed/shell/command_s3_configure.go
parent31f9f528db11a10d72e86e895bbd663397a0b32f (diff)
downloadseaweedfs-ab1b9697e6c1eabd3f097a6fc28caf40e73ba7ed.tar.xz
seaweedfs-ab1b9697e6c1eabd3f097a6fc28caf40e73ba7ed.zip
supplement check duplicate accesskey
Diffstat (limited to 'weed/shell/command_s3_configure.go')
-rw-r--r--weed/shell/command_s3_configure.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.go
index 0660b7889..422df2e75 100644
--- a/weed/shell/command_s3_configure.go
+++ b/weed/shell/command_s3_configure.go
@@ -2,14 +2,14 @@ package shell
import (
"bytes"
- "errors"
"flag"
"fmt"
- "github.com/chrislusf/seaweedfs/weed/filer"
"io"
"sort"
"strings"
+ "github.com/chrislusf/seaweedfs/weed/filer"
+
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/pb/iam_pb"
)
@@ -165,15 +165,8 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io
s3cfg.Identities = append(s3cfg.Identities, &identity)
}
- accessKeySet := make(map[string]string)
- for _, ident := range s3cfg.Identities {
- for _, cred := range ident.Credentials {
- if userName, found := accessKeySet[cred.AccessKey]; !found {
- accessKeySet[cred.AccessKey] = ident.Name
- } else {
- return errors.New(fmt.Sprintf("duplicate accessKey[%s], already configured in user[%s]", cred.AccessKey, userName))
- }
- }
+ if err = filer.CheckDuplicateAccessKey(s3cfg); err != nil {
+ return err
}
buf.Reset()