add debug logs to vault implementation

This commit is contained in:
Brad Rydzewski 2018-02-23 09:11:47 -08:00
parent 5f5a0413fe
commit 5e557bb2d8

View file

@ -92,17 +92,24 @@ func (v *vault) list(repo *model.Repo, build *model.Build) ([]*model.Secret, err
continue continue
} }
logrus.Debugf("vault: read secret: %s", path)
vaultSecret, err := v.get(path) vaultSecret, err := v.get(path)
if err != nil { if err != nil {
logrus.Debugf("vault: read secret failed: %s: %s", path, err)
return nil, err return nil, err
} }
if vaultSecret == nil { if vaultSecret == nil {
logrus.Debugf("vault: read secret failed: %s: not found or empty value", path)
continue continue
} }
if !vaultSecret.Match(repo.FullName) { if !vaultSecret.Match(repo.FullName) {
logrus.Debugf("vault: read secret: %s: restricted: %s", path, repo.FullName)
continue continue
} }
logrus.Debugf("vault: read secret success: %s", err)
secrets = append(secrets, &model.Secret{ secrets = append(secrets, &model.Secret{
Name: key, Name: key,
Value: vaultSecret.Value, Value: vaultSecret.Value,
@ -133,7 +140,7 @@ func (v *vault) start() {
if v.done != nil { if v.done != nil {
close(v.done) close(v.done)
} }
logrus.Debugf("vault: token renewal enabled: renew every %v", v.renew) logrus.Infof("vault: token renewal enabled: renew every %v", v.renew)
v.done = make(chan struct{}) v.done = make(chan struct{})
if v.renew != 0 { if v.renew != 0 {
go v.renewLoop() go v.renewLoop()