Skip to content

Commit f25c4a4

Browse files
committed
Pass secretValues
1 parent 7287ece commit f25c4a4

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

internal/pkg/policy/parsed_policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func NewParsedPolicy(ctx context.Context, bulker bulk.Bulk, p model.Policy) (*Pa
9090
// FIXME: Replace secrets in 'agent.download' section of policy
9191
if agentDownload, exists := p.Data.Agent["download"]; exists {
9292
if section, ok := agentDownload.(map[string]interface{}); ok {
93-
agentDownloadSecretKeys, err := secret.ProcessAgentDownloadSecrets(ctx, section, bulker)
93+
agentDownloadSecretKeys, err := secret.ProcessAgentDownloadSecrets(section, secretValues)
9494
if err != nil {
9595
return nil, fmt.Errorf("error processing agent secrets: %w", err)
9696
}

internal/pkg/secret/secret.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,26 +379,13 @@ func processOutputWithInlineSecrets(output smap.Map, secretValues map[string]str
379379
}
380380

381381
// ProcessAgentDownloadSecrets reads and replaces secrets in the agent.download section of the policy
382-
func ProcessAgentDownloadSecrets(ctx context.Context, agentDownload smap.Map, bulker bulk.Bulk) ([]string, error) {
382+
func ProcessAgentDownloadSecrets(agentDownload smap.Map, secretValues map[string]string) ([]string, error) {
383383
secrets := agentDownload.GetMap(FieldSecrets)
384384
delete(agentDownload, FieldSecrets)
385385

386-
secretReferences := make([]model.SecretReferencesItems, 0)
387386
agentDownloadSecrets := getSecretIDAndPath(secrets)
388387
keys := make([]string, 0, len(agentDownloadSecrets))
389388

390-
for _, secret := range agentDownloadSecrets {
391-
secretReferences = append(secretReferences, model.SecretReferencesItems{
392-
ID: secret.ID,
393-
})
394-
}
395-
if len(secretReferences) == 0 {
396-
return nil, nil
397-
}
398-
secretValues, err := GetSecretValues(ctx, secretReferences, bulker)
399-
if err != nil {
400-
return nil, err
401-
}
402389
for _, secret := range agentDownloadSecrets {
403390
var key string
404391
for _, p := range secret.Path {

0 commit comments

Comments
 (0)