From 3ecaad0e0e9670eda92fa17ddb96f23fcd4159a7 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Fri, 12 Jan 2024 03:52:39 +0100 Subject: [PATCH] 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. --- nixos/modules/services/networking/keepalived/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/networking/keepalived/default.nix b/nixos/modules/services/networking/keepalived/default.nix index 429a47c3962c..bf5e96f001a8 100644 --- a/nixos/modules/services/networking/keepalived/default.nix +++ b/nixos/modules/services/networking/keepalived/default.nix @@ -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}