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

Daniel Krambrock krambrock at hrz.uni-marburg.de
Tue Apr 16 13:27:44 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 v2:
 * code-style fix

 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..8979413 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) {
+    for 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