mirror of
git://git.proxmox.com/git/pve-network.git
synced 2025-01-21 22:03:53 +03:00
validation: add support for arrays to change tracking
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>
This commit is contained in:
parent
1032f6d838
commit
fb97ed300a
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user