From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9570299CF1 for ; Mon, 15 May 2023 11:07:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 760C3881F for ; Mon, 15 May 2023 11:07:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 15 May 2023 11:07:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BD51043511 for ; Mon, 15 May 2023 11:07:57 +0200 (CEST) Date: Mon, 15 May 2023 11:07:57 +0200 From: Wolfgang Bumiller To: Dominik Csapak Cc: pve-devel@lists.proxmox.com Message-ID: <20230515090757.2azfd7aw4v5zn4gr@casey.proxmox.com> References: <20230512122355.3244212-1-d.csapak@proxmox.com> <20230512122355.3244212-3-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230512122355.3244212-3-d.csapak@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.133 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH v2 common 2/3] section config: implement array support X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 May 2023 09:07:58 -0000 On Fri, May 12, 2023 at 02:23:49PM +0200, Dominik Csapak wrote: > enables section configs in the style of: > > ---- > type: id > property value > property value2 > property value3 > ---- > > can be combined with property strings > > the provided create and update schema just pass through the array type > to the api, so the api call must always contain the complete array > > also adds a test case for such array fields > > Signed-off-by: Dominik Csapak > --- > changes from v1: > * don't special encode arrays anymore, but instead have always the whole > array as parameter in the create/updateSchema > src/PVE/SectionConfig.pm | 64 +++++++++++++++++++++++++++---------- > test/section_config_test.pl | 26 +++++++++++++++ > 2 files changed, 74 insertions(+), 16 deletions(-) > > diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm > index f36cede..03f6a52 100644 > --- a/src/PVE/SectionConfig.pm > +++ b/src/PVE/SectionConfig.pm > @@ -51,6 +51,17 @@ sub plugindata { > return {}; > } > > +my $copy_property = sub { If you're moving it, maybe *re*move it and change the single caller of it to just do `{ %$src }`, since that's all this does ;-) > + my ($src) = @_; > + > + my $res = {}; > + foreach my $k (keys %$src) { > + $res->{$k} = $src->{$k}; > + } > + > + return $res; > +}; > + > sub createSchema { > my ($class, $skip_type) = @_; >