chore: execute goimports to format the code (#7983)
* chore: execute goimports to format the code Signed-off-by: promalert <promalert@outlook.com> * goimports -w . --------- Signed-off-by: promalert <promalert@outlook.com> Co-authored-by: Chris Lu <chris.lu@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
func (store *FilerEtcStore) LoadConfiguration(ctx context.Context) (*iam_pb.S3ApiConfiguration, error) {
|
||||
s3cfg := &iam_pb.S3ApiConfiguration{}
|
||||
|
||||
glog.V(1).Infof("Loading IAM configuration from %s/%s (using current active filer)",
|
||||
glog.V(1).Infof("Loading IAM configuration from %s/%s (using current active filer)",
|
||||
filer.IamConfigDirectory, filer.IamIdentityFile)
|
||||
|
||||
err := store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
@@ -25,31 +25,31 @@ func (store *FilerEtcStore) LoadConfiguration(ctx context.Context) (*iam_pb.S3Ap
|
||||
content, err := filer.ReadInsideFiler(client, filer.IamConfigDirectory, filer.IamIdentityFile)
|
||||
if err != nil {
|
||||
if err == filer_pb.ErrNotFound {
|
||||
glog.V(1).Infof("IAM identity file not found at %s/%s, no credentials loaded",
|
||||
glog.V(1).Infof("IAM identity file not found at %s/%s, no credentials loaded",
|
||||
filer.IamConfigDirectory, filer.IamIdentityFile)
|
||||
return nil
|
||||
}
|
||||
glog.Errorf("Failed to read IAM identity file from %s/%s: %v",
|
||||
glog.Errorf("Failed to read IAM identity file from %s/%s: %v",
|
||||
filer.IamConfigDirectory, filer.IamIdentityFile, err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
if len(content) == 0 {
|
||||
glog.V(1).Infof("IAM identity file at %s/%s is empty",
|
||||
glog.V(1).Infof("IAM identity file at %s/%s is empty",
|
||||
filer.IamConfigDirectory, filer.IamIdentityFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.V(2).Infof("Read %d bytes from %s/%s",
|
||||
|
||||
glog.V(2).Infof("Read %d bytes from %s/%s",
|
||||
len(content), filer.IamConfigDirectory, filer.IamIdentityFile)
|
||||
|
||||
|
||||
if err := filer.ParseS3ConfigurationFromBytes(content, s3cfg); err != nil {
|
||||
glog.Errorf("Failed to parse IAM configuration from %s/%s: %v",
|
||||
glog.Errorf("Failed to parse IAM configuration from %s/%s: %v",
|
||||
filer.IamConfigDirectory, filer.IamIdentityFile, err)
|
||||
return err
|
||||
}
|
||||
|
||||
glog.V(1).Infof("Successfully parsed IAM configuration with %d identities and %d accounts",
|
||||
|
||||
glog.V(1).Infof("Successfully parsed IAM configuration with %d identities and %d accounts",
|
||||
len(s3cfg.Identities), len(s3cfg.Accounts))
|
||||
return nil
|
||||
})
|
||||
@@ -63,7 +63,7 @@ func (store *FilerEtcStore) LoadConfiguration(ctx context.Context) (*iam_pb.S3Ap
|
||||
for _, identity := range s3cfg.Identities {
|
||||
credCount := len(identity.Credentials)
|
||||
actionCount := len(identity.Actions)
|
||||
glog.V(2).Infof(" Identity: %s (credentials: %d, actions: %d)",
|
||||
glog.V(2).Infof(" Identity: %s (credentials: %d, actions: %d)",
|
||||
identity.Name, credCount, actionCount)
|
||||
for _, cred := range identity.Credentials {
|
||||
glog.V(3).Infof(" Access Key: %s", cred.AccessKey)
|
||||
|
||||
@@ -24,14 +24,14 @@ func (store *FilerEtcStore) GetPolicies(ctx context.Context) (map[string]policy_
|
||||
store.mu.RLock()
|
||||
configured := store.filerAddressFunc != nil
|
||||
store.mu.RUnlock()
|
||||
|
||||
|
||||
if !configured {
|
||||
glog.V(1).Infof("Filer client not configured for policy retrieval, returning empty policies")
|
||||
// Return empty policies if filer client is not configured
|
||||
return policiesCollection.Policies, nil
|
||||
}
|
||||
|
||||
glog.V(2).Infof("Loading IAM policies from %s/%s (using current active filer)",
|
||||
glog.V(2).Infof("Loading IAM policies from %s/%s (using current active filer)",
|
||||
filer.IamConfigDirectory, filer.IamPoliciesFile)
|
||||
|
||||
err := store.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
@@ -41,27 +41,27 @@ func (store *FilerEtcStore) GetPolicies(ctx context.Context) (map[string]policy_
|
||||
content, err := filer.ReadInsideFiler(client, filer.IamConfigDirectory, filer.IamPoliciesFile)
|
||||
if err != nil {
|
||||
if err == filer_pb.ErrNotFound {
|
||||
glog.V(1).Infof("Policies file not found at %s/%s, returning empty policies",
|
||||
glog.V(1).Infof("Policies file not found at %s/%s, returning empty policies",
|
||||
filer.IamConfigDirectory, filer.IamPoliciesFile)
|
||||
// If file doesn't exist, return empty collection
|
||||
return nil
|
||||
}
|
||||
glog.Errorf("Failed to read IAM policies file from %s/%s: %v",
|
||||
glog.Errorf("Failed to read IAM policies file from %s/%s: %v",
|
||||
filer.IamConfigDirectory, filer.IamPoliciesFile, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if len(content) == 0 {
|
||||
glog.V(2).Infof("IAM policies file at %s/%s is empty",
|
||||
glog.V(2).Infof("IAM policies file at %s/%s is empty",
|
||||
filer.IamConfigDirectory, filer.IamPoliciesFile)
|
||||
return nil
|
||||
}
|
||||
|
||||
glog.V(2).Infof("Read %d bytes from %s/%s",
|
||||
glog.V(2).Infof("Read %d bytes from %s/%s",
|
||||
len(content), filer.IamConfigDirectory, filer.IamPoliciesFile)
|
||||
|
||||
if err := json.Unmarshal(content, policiesCollection); err != nil {
|
||||
glog.Errorf("Failed to parse IAM policies from %s/%s: %v",
|
||||
glog.Errorf("Failed to parse IAM policies from %s/%s: %v",
|
||||
filer.IamConfigDirectory, filer.IamPoliciesFile, err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (store *FilerEtcStore) withFilerClient(fn func(client filer_pb.SeaweedFiler
|
||||
filerAddress := store.filerAddressFunc()
|
||||
dialOption := store.grpcDialOption
|
||||
store.mu.RUnlock()
|
||||
|
||||
|
||||
if filerAddress == "" {
|
||||
return fmt.Errorf("filer_etc: no filer discovered yet - please ensure a filer is running and accessible")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user