From b8733ec1f350baae608ca13af0804f87c65dae5c Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Thu, 11 Apr 2019 18:48:57 +0200 Subject: [PATCH] fix #2172: sort mynetworks template var to make postfix config rewrite stable The mynetworks template_var is written to postfix/main.cf, causing a postfix restart on every change. Since mynetworks is a hash the order of the networks potentially changes with every invocation. This shows quite readily in clustered setups where pmgmirror writes the configs and checks for changes once every 2 minutes. fixes #2172 Signed-off-by: Stoiko Ivanov --- PMG/Config.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PMG/Config.pm b/PMG/Config.pm index 9f1c001..6aa7d06 100755 --- a/PMG/Config.pm +++ b/PMG/Config.pm @@ -1192,7 +1192,7 @@ sub get_template_vars { } my $netlist = PVE::INotify::read_file('mynetworks'); - foreach my $cidr (keys %$netlist) { + foreach my $cidr (sort keys %$netlist) { if ($cidr =~ m/^($IPV6RE)\/(\d+)$/) { push @$mynetworks, "[$1]/$2"; } else { -- 2.39.2