Skip to content

Commit

Permalink
Merge pull request #58 from ferringb/master
Browse files Browse the repository at this point in the history
Fix regression introduced in 1.6.1 inducing actions being continually ran upon remote CA change
  • Loading branch information
cbroglie authored Jan 25, 2019
2 parents 56b5f8e + 8f8c98a commit 7c50ea3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func (ca *CA) writeCert(cert []byte) error {
}
log.Infof("cert: wrote CA certificate: %s", ca.File.Path)

// see CA.Load(); strip prefix/trailing whitespace to ensure our bytes.Equal() checks don't false positive.
ca.pem = []byte(strings.TrimSpace(string(cert[:])))
err = ca.File.Set()
return err
}
Expand Down Expand Up @@ -132,6 +130,11 @@ func (ca *CA) Refresh() (bool, error) {
if ca.File != nil {
err = ca.writeCert(cert)
}
// If there were no errors, update our internal notion of what the CA is.
if err != nil {
// see CA.Load(); strip prefix/trailing whitespace to ensure our bytes.Equal() checks don't false positive.
ca.pem = []byte(strings.TrimSpace(string(cert[:])))
}

return true, err
}
Expand Down
1 change: 1 addition & 0 deletions mgr/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type CertServiceManager struct {
}

func (csm *CertServiceManager) TakeAction(change_type string) error {
log.Infof("manager: executing configured action due to change type %s for %s", change_type, csm.Cert.Path)
ca_path := ""
if csm.CA.File != nil {
ca_path = csm.CA.File.Path
Expand Down

0 comments on commit 7c50ea3

Please sign in to comment.