Skip to content

Commit

Permalink
fix(oss): fixed ram role generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushi Sharma committed Mar 7, 2025
1 parent 8762570 commit 8c62095
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/providers/oss/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ func (p *provider) getOSSClient(pc *domain.ProviderConfig, ramRole string) (*oss
// Check cache for existing client
if cachedClient, exists := p.ossClients[cachedClientKey]; exists {
if cachedClient.authConfig.IsConfigValid() {
fmt.Println("Using cached OSS client")
return cachedClient.client, nil
}
p.mu.Lock()
Expand All @@ -410,7 +411,7 @@ func (p *provider) getOSSClient(pc *domain.ProviderConfig, ramRole string) (*oss
p.mu.Lock()
defer p.mu.Unlock()
p.ossClients[cachedClientKey] = OSSClient{client: client, authConfig: authConfig}

fmt.Println("Created new OSS client")
return client, nil
}

Expand Down Expand Up @@ -443,7 +444,7 @@ func getRAMRole(g domain.Grant) (string, error) {
if err != nil {
return "", err
}
return fmt.Sprintf("acs:ram::%s:role/guardian.bot", resourceAccountID), nil
return fmt.Sprintf("acs:ram::%s:role/guardian-bot", resourceAccountID), nil
}

func getAccountIDFromResource(resource *domain.Resource) (string, error) {
Expand Down

0 comments on commit 8c62095

Please sign in to comment.