public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Hannes Dürr" <h.duerr@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Hanreich <s.hanreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-network] validation: add support for arrays to change tracking
Date: Tue, 28 Nov 2023 14:49:45 +0100	[thread overview]
Message-ID: <b7520c27-9cf5-4c64-8d8f-273c14fd04f0@proxmox.com> (raw)
In-Reply-To: <20231122122808.214325-1-s.hanreich@proxmox.com>

Tested-by: Hannes Duerr <h.duerr@proxmox.com>

On 11/22/23 13:28, Stefan Hanreich wrote:
> 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>
> ---
>   src/PVE/Network/SDN.pm | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
> index c306527..3af09b5 100644
> --- a/src/PVE/Network/SDN.pm
> +++ b/src/PVE/Network/SDN.pm
> @@ -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;




  reply	other threads:[~2023-11-28 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 12:28 Stefan Hanreich
2023-11-28 13:49 ` Hannes Dürr [this message]
2023-11-29  9:29 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7520c27-9cf5-4c64-8d8f-273c14fd04f0@proxmox.com \
    --to=h.duerr@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal