Skip to content

Commit

Permalink
Fixing the interchange issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Shifna12Zarnaz committed Jun 12, 2024
1 parent ba5688a commit d2447fc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions internal/api/vault_secret_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"sort"
// "sort"

"github.com/intelops/vault-cred/internal/client"
"github.com/intelops/vault-cred/proto/pb/vaultcredpb"
Expand Down Expand Up @@ -34,15 +34,15 @@ func (v *VaultCredServ) ConfigureVaultSecret(ctx context.Context, request *vault
})
}

sort.SliceStable(secretPathProperties, func(i, j int) bool {
if secretPathProperties[i].SecretKey != secretPathProperties[j].SecretKey {
return secretPathProperties[i].SecretKey < secretPathProperties[j].SecretKey
}
if secretPathProperties[i].SecretPath != secretPathProperties[j].SecretPath {
return secretPathProperties[i].SecretPath < secretPathProperties[j].SecretPath
}
return secretPathProperties[i].Property < secretPathProperties[j].Property
})
// sort.SliceStable(secretPathProperties, func(i, j int) bool {
// if secretPathProperties[i].SecretKey != secretPathProperties[j].SecretKey {
// return secretPathProperties[i].SecretKey < secretPathProperties[j].SecretKey
// }
// if secretPathProperties[i].SecretPath != secretPathProperties[j].SecretPath {
// return secretPathProperties[i].SecretPath < secretPathProperties[j].SecretPath
// }
// return secretPathProperties[i].Property < secretPathProperties[j].Property
// })

secretPaths := []string{}
secretPathsData := map[string][]string{}
Expand All @@ -57,6 +57,8 @@ func (v *VaultCredServ) ConfigureVaultSecret(ctx context.Context, request *vault
propertiesData[spp.SecretKey] = append(propertiesData[spp.SecretKey], spp.SecretKey)
}
}
v.log.Info("Properties Data", propertiesData)
v.log.Infof("Secret Paths Data: %v", secretPathsData)

appRoleName := "kad-" + request.SecretName

Expand Down Expand Up @@ -94,8 +96,6 @@ func (v *VaultCredServ) ConfigureVaultSecret(ctx context.Context, request *vault

externalSecretName := "ext-secret-" + request.SecretName

v.log.Infof("Secret Paths Data: %v", secretPathsData)

err = k8sClient.CreateOrUpdateExternalSecret(ctx, externalSecretName, request.Namespace, secretStoreName, request.SecretName, "", secretPathsData, propertiesData)
if err != nil {
v.log.Errorf("Failed to create vault external secret: %v", err)
Expand Down

0 comments on commit d2447fc

Please sign in to comment.