nixos/networking/keepalived: do not emit unicastPeers when there are none

In the past, we emitted `unicast_peer` block even with empty unicast peers list.

This now results in:
```
Keepalived_vrrp[392762]: A unicast keyword has been specified without any unicast peers. Defaulting to multicast. This usage is deprecated - please update your configuration.
```

We do not emit it anymore to avoid this warning.
This commit is contained in:
Raito Bezarius
2024-01-12 03:52:39 +01:00
parent e28b1c21cd
commit 3ecaad0e0e

View File

@@ -59,9 +59,11 @@ let
${optionalString i.vmacXmitBase "vmac_xmit_base"}
${optionalString (i.unicastSrcIp != null) "unicast_src_ip ${i.unicastSrcIp}"}
unicast_peer {
${concatStringsSep "\n" i.unicastPeers}
}
${optionalString (builtins.length i.unicastPeers > 0) ''
unicast_peer {
${concatStringsSep "\n" i.unicastPeers}
}
''}
virtual_ipaddress {
${concatMapStringsSep "\n" virtualIpLine i.virtualIps}