Skip to content

Commit

Permalink
Better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgroth committed Aug 6, 2019
1 parent bbc2931 commit fcbd682
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/helmexec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,17 @@ func (helm *execer) List(context HelmContext, filter string, flags ...string) (s
}

func (helm *execer) DecryptSecret(context HelmContext, name string, flags ...string) (string, error) {
helm.decryptedSecretMutex.Lock()

var secret *decryptedSecret

absPath, err := filepath.Abs(name)
if err != nil {
return "", err
}

var secret *decryptedSecret
helm.logger.Debugf("Waiting for cache mutext for secret %v", absPath)
helm.decryptedSecretMutex.Lock()
helm.logger.Debugf("Cache mutex for secret %v acquired", absPath)

// Cache miss
if _, ok := helm.decryptedSecrets[absPath]; !ok {
Expand Down Expand Up @@ -179,11 +182,11 @@ func (helm *execer) DecryptSecret(context HelmContext, name string, flags ...str

} else {
// Cache hit
helm.logger.Debugf("Using cached secret %v", absPath)
helm.logger.Debugf("Found secret in cache %v", absPath)

secret = helm.decryptedSecrets[absPath]
helm.decryptedSecretMutex.Unlock()
secret.mutex.RLock()
helm.decryptedSecretMutex.Unlock()
defer secret.mutex.RUnlock()
}

Expand Down

0 comments on commit fcbd682

Please sign in to comment.