Browse Source

agent: Fix assignment of error when auto-reloading cert and key file changes. (#15769)

* Adding the setting of errors missing in config file watcher code in agent.

* add changelog
pull/15659/head^2
John Murret 2 years ago committed by GitHub
parent
commit
cd53120cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .changelog/15769.txt
  2. 7
      agent/agent.go

3
.changelog/15769.txt

@ -0,0 +1,3 @@
```release-note:bug
agent: Fix assignment of error when auto-reloading cert and key file changes.
```

7
agent/agent.go

@ -5,7 +5,6 @@ import (
"crypto/tls" "crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/hashicorp/consul/proto/pboperator"
"io" "io"
"net" "net"
"net/http" "net/http"
@ -18,6 +17,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/hashicorp/consul/proto/pboperator"
"github.com/armon/go-metrics" "github.com/armon/go-metrics"
"github.com/armon/go-metrics/prometheus" "github.com/armon/go-metrics/prometheus"
"github.com/hashicorp/go-connlimit" "github.com/hashicorp/go-connlimit"
@ -4026,13 +4027,13 @@ func (a *Agent) reloadConfig(autoReload bool) error {
{a.config.TLS.HTTPS, newCfg.TLS.HTTPS}, {a.config.TLS.HTTPS, newCfg.TLS.HTTPS},
} { } {
if f.oldCfg.KeyFile != f.newCfg.KeyFile { if f.oldCfg.KeyFile != f.newCfg.KeyFile {
a.configFileWatcher.Replace(f.oldCfg.KeyFile, f.newCfg.KeyFile) err = a.configFileWatcher.Replace(f.oldCfg.KeyFile, f.newCfg.KeyFile)
if err != nil { if err != nil {
return err return err
} }
} }
if f.oldCfg.CertFile != f.newCfg.CertFile { if f.oldCfg.CertFile != f.newCfg.CertFile {
a.configFileWatcher.Replace(f.oldCfg.CertFile, f.newCfg.CertFile) err = a.configFileWatcher.Replace(f.oldCfg.CertFile, f.newCfg.CertFile)
if err != nil { if err != nil {
return err return err
} }

Loading…
Cancel
Save