]> git.proxmox.com Git - pmg-api.git/commitdiff
fix #2172: sort mynetworks template var to make postfix config rewrite stable
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 11 Apr 2019 16:48:57 +0000 (18:48 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 12 Apr 2019 07:47:26 +0000 (09:47 +0200)
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 <s.ivanov@proxmox.com>
PMG/Config.pm

index 9f1c001e5913630f81a427dcebb08af745cddfb2..6aa7d06e1334510dfabf2b7f6b79d766a80b51a1 100755 (executable)
@@ -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 {