backport of commit e439289be5 (#19746)

This commit is contained in:
hc-github-team-secure-vault-core
2023-03-24 11:01:52 -04:00
committed by GitHub
parent 318ac8bbc0
commit d622e81106
2 changed files with 4 additions and 1 deletions

3
changelog/19721.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
core: Fix regression breaking non-raft clusters whose nodes share the same cluster_addr/api_addr.
```

View File

@@ -235,7 +235,7 @@ func (c *Core) Leader() (isLeader bool, leaderAddr, clusterAddr string, err erro
// to ourself, there's no point in paying any attention to it. And by
// disregarding it, we can avoid a panic in raft tests using the Inmem network
// layer when we try to connect back to ourself.
if adv.ClusterAddr == c.ClusterAddr() && adv.RedirectAddr == c.redirectAddr {
if adv.ClusterAddr == c.ClusterAddr() && adv.RedirectAddr == c.redirectAddr && c.getRaftBackend() != nil {
return false, "", "", nil
}