[PATCH v2 firewall] fix #5335: stable sorting in cluster.fw

Daniel Krambrock krambrock at hrz.uni-marburg.de
Tue Apr 16 09:26:45 CEST 2024


Stable sorting in cluster.fw config file allows tracking changes by
checking into git or when using automation like ansible.

Signed-off-by: Daniel Krambrock <krambrock at hrz.uni-marburg.de>
---
 changes since v1:
 * added commit message

 src/PVE/Firewall.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 77cbaf4..81a8798 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -3360,7 +3360,7 @@ my $format_aliases = sub {
     my $raw = '';
 
     $raw .= "[ALIASES]\n\n";
-    foreach my $k (keys %$aliases) {
+    foreach my $k (sort keys %$aliases) {
 	my $e = $aliases->{$k};
 	$raw .= "$e->{name} $e->{cidr}";
 	$raw .= " # " . encode('utf8', $e->{comment})
-- 
2.39.2




More information about the pve-devel mailing list