]> git.proxmox.com Git - pve-network.git/commitdiff
validation: add support for arrays to change tracking
authorStefan Hanreich <s.hanreich@proxmox.com>
Wed, 22 Nov 2023 12:28:08 +0000 (13:28 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 29 Nov 2023 09:28:26 +0000 (10:28 +0100)
This is needed so dhcp-ranges are properly displayed as changed in the
web UI.

Also took the chance to properly indent the encode_value function with
our indentation scheme.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
src/PVE/Network/SDN.pm

index c306527236c23aabffca9796b91a2cd5f1fe63d8..3af09b5caef5283c3cab450ba0e17a21796b4d24 100644 (file)
@@ -241,12 +241,14 @@ sub generate_dhcp_config {
 sub encode_value {
     my ($type, $key, $value) = @_;
 
-    if ($key eq 'nodes' || $key eq 'exitnodes') {
-        if(ref($value) eq 'HASH') {
-            return join(',', sort keys(%$value));
-        } else {
-            return $value;
-        }
+    if ($key eq 'nodes' || $key eq 'exitnodes' || $key eq 'dhcp-range') {
+       if (ref($value) eq 'HASH') {
+           return join(',', sort keys(%$value));
+       } elsif (ref($value) eq 'ARRAY') {
+           return join(',', sort @$value);
+       } else {
+           return $value;
+       }
     }
 
     return $value;