[pmg-devel] [PATCH pmg-api 1/2] PMG::Config: sort mynetworks in get_template_vars

Stoiko Ivanov s.ivanov at proxmox.com
Thu Apr 11 18:48:57 CEST 2019


fix #2172

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.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 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.11.0




More information about the pmg-devel mailing list