Skip to content

Commit

Permalink
also remove the redundant use of context logger where possible
Browse files Browse the repository at this point in the history
AB#9209
  • Loading branch information
Robin Bryce committed Mar 19, 2024
1 parent a75cfc2 commit 16220c7
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions azkeys/keyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ func (kv *KeyVault) GetKeyByKID(
ctx context.Context, keyID string,
) (keyvault.KeyBundle, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

kvClient, err := NewKvClient(kv.Authorizer)
if err != nil {
return keyvault.KeyBundle{}, err
Expand All @@ -65,9 +62,6 @@ func (kv *KeyVault) GetLatestKey(
ctx context.Context, keyName string,
) (keyvault.KeyBundle, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

kvClient, err := NewKvClient(kv.Authorizer)
if err != nil {
return keyvault.KeyBundle{}, err
Expand Down Expand Up @@ -134,11 +128,6 @@ func (kv *KeyVault) GetKeyVersionsKeys(
// getKeysFromVersions gets the keys from the given key versions
func (kv *KeyVault) getKeysFromVersions(ctx context.Context, keyVersions []keyvault.KeyItem) ([]keyvault.KeyBundle, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

log.Infof("getKeysFromVersions")

keys := []keyvault.KeyBundle{}

for _, keyVersionValue := range keyVersions {
Expand Down Expand Up @@ -188,9 +177,6 @@ func (kv *KeyVault) Sign(
algorithm keyvault.JSONWebKeySignatureAlgorithm,
) ([]byte, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

kvClient, err := NewKvClient(kv.Authorizer)
if err != nil {
return []byte{}, fmt.Errorf("failed to create keyvault client: %w", err)
Expand Down Expand Up @@ -243,9 +229,6 @@ func (kv *KeyVault) HashAndSign(
algorithm keyvault.JSONWebKeySignatureAlgorithm,
) ([]byte, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

key, err := kv.GetKeyByKID(ctx, keyID)
if err != nil {
return nil, fmt.Errorf("failed to get key: %w", err)
Expand Down Expand Up @@ -274,11 +257,6 @@ func (kv *KeyVault) Verify(
algorithm keyvault.JSONWebKeySignatureAlgorithm,
) (bool, error) {

log := logger.Sugar.FromContext(ctx)
defer log.Close()

log.Infof("Verify: %s %s", kv.url, keyID)

kvClient, err := NewKvClient(kv.Authorizer)
if err != nil {
return false, fmt.Errorf("failed to create keyvault client: %w", err)
Expand Down

0 comments on commit 16220c7

Please sign in to comment.