consul.passthru.tests: Refactor: Extract variable
This commit is contained in:
parent
777d1c0944
commit
25d665634a
@ -55,6 +55,7 @@ let
|
|||||||
|
|
||||||
server = index: { pkgs, ... }:
|
server = index: { pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
numConsensusServers = builtins.length allConsensusServerHosts;
|
||||||
thisConsensusServerHost = builtins.elemAt allConsensusServerHosts index;
|
thisConsensusServerHost = builtins.elemAt allConsensusServerHosts index;
|
||||||
ip = thisConsensusServerHost; # since we already use IPs to identify servers
|
ip = thisConsensusServerHost; # since we already use IPs to identify servers
|
||||||
in
|
in
|
||||||
@ -71,12 +72,12 @@ let
|
|||||||
inherit webUi;
|
inherit webUi;
|
||||||
extraConfig = defaultExtraConfig // {
|
extraConfig = defaultExtraConfig // {
|
||||||
server = true;
|
server = true;
|
||||||
bootstrap_expect = builtins.length allConsensusServerHosts;
|
bootstrap_expect = numConsensusServers;
|
||||||
retry_join =
|
retry_join =
|
||||||
# If there's only 1 node in the network, we allow self-join;
|
# If there's only 1 node in the network, we allow self-join;
|
||||||
# otherwise, the node must not try to join itself, and join only the other servers.
|
# otherwise, the node must not try to join itself, and join only the other servers.
|
||||||
# See https://github.com/hashicorp/consul/issues/2868
|
# See https://github.com/hashicorp/consul/issues/2868
|
||||||
if builtins.length allConsensusServerHosts == 1
|
if numConsensusServers == 1
|
||||||
then allConsensusServerHosts
|
then allConsensusServerHosts
|
||||||
else builtins.filter (h: h != thisConsensusServerHost) allConsensusServerHosts;
|
else builtins.filter (h: h != thisConsensusServerHost) allConsensusServerHosts;
|
||||||
bind_addr = ip;
|
bind_addr = ip;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user