From: Dominik Csapak <d.csapak@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager 1/1] vzdump: prepare 'exclude-path' for array format
Date: Mon, 5 Jun 2023 09:54:49 +0200 [thread overview]
Message-ID: <fec9228c-13b7-15a7-f6b0-1ab8583c9a5d@proxmox.com> (raw)
In-Reply-To: <rn7of3wm3kv5425aile3ejyjc7u4le35fzhyt26agtrg3caquc@gnzwzh7ryqhh>
On 6/5/23 09:36, Wolfgang Bumiller wrote:
> On Fri, May 12, 2023 at 02:23:51PM +0200, Dominik Csapak wrote:
>> we want to move the 'exclude-path' to an array format (from 'string-alist')
>> prepare the code that it can be either a string or a list
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>> PVE/VZDump.pm | 21 +++++++++++++++++----
>> 1 file changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
>> index a04837e7e..dde347562 100644
>> --- a/PVE/VZDump.pm
>> +++ b/PVE/VZDump.pm
>> @@ -279,7 +279,15 @@ sub read_vzdump_defaults {
>> my $conf_schema = { type => 'object', properties => $confdesc_for_defaults };
>> my $res = PVE::JSONSchema::parse_config($conf_schema, $fn, $raw);
>> if (my $excludes = $res->{'exclude-path'}) {
>> - $res->{'exclude-path'} = PVE::Tools::split_args($excludes);
>> + if (ref($excludes) eq 'ARRAY') {
>> + my $list = [];
>> + for my $path ($excludes->@*) {
>> + push $list->@*, PVE::Tools::split_args($path)->@*;
>
> With this being an array, I don't think it makes sense to call
> `split_args()` on the individual items?
actually we have to do this to keep compatibility with current configs:
currently users can put things like this in the config:
exclude-path: /foo /bar
and both paths will be excluded
if we omit the splitting we'd have to rewrite the configs to:
exclude-path: /foo
exclude-path: /bar
while we could do that, i opted here for the simpler approach to handle
the lines the same, without need to break existing configs
and/or rewriting configs on upgrade
>
>> + }
>> + $res->{'exclude-path'} = $list;
>> + } else {
>> + $res->{'exclude-path'} = PVE::Tools::split_args($excludes);
>> + }
>> }
>> if (defined($res->{mailto})) {
>> my @mailto = split_list($res->{mailto});
>> @@ -1339,10 +1347,15 @@ sub option_exists {
>> sub parse_mailto_exclude_path {
>> my ($param) = @_;
>>
>> - # exclude-path list need to be 0 separated
>> + # exclude-path list need to be 0 separated or be an array
>> if (defined($param->{'exclude-path'})) {
>> - my @expaths = split(/\0/, $param->{'exclude-path'} || '');
>> - $param->{'exclude-path'} = [ @expaths ];
>> + my $expaths;
>> + if (ref($param->{'exclude-path'}) eq 'ARRAY') {
>> + $expaths = $param->{'exclude-path'};
>> + } else {
>> + $expaths = [split(/\0/, $param->{'exclude-path'} || '')];
>> + }
>> + $param->{'exclude-path'} = $expaths;
>> }
>>
>> if (defined($param->{mailto})) {
>> --
>> 2.30.2
next prev parent reply other threads:[~2023-06-05 7:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 12:23 [pve-devel] [PATCH common/manager/http/guest/qemu-server] schema/config array support Dominik Csapak
2023-05-12 12:23 ` [pve-devel] [PATCH common 1/3] JSONSchema: add support for array parameter in api calls, cli and config Dominik Csapak
2023-06-05 8:36 ` Wolfgang Bumiller
2023-05-12 12:23 ` [pve-devel] [PATCH v2 common 2/3] section config: implement array support Dominik Csapak
2023-05-15 9:07 ` Wolfgang Bumiller
2023-05-15 9:19 ` Dominik Csapak
2023-05-12 12:23 ` [pve-devel] [PATCH common 3/3] JSONSchema: disable '-alist' format Dominik Csapak
2023-06-05 8:36 ` Wolfgang Bumiller
2023-05-12 12:23 ` [pve-devel] [PATCH manager 1/1] vzdump: prepare 'exclude-path' for array format Dominik Csapak
2023-06-05 7:36 ` Wolfgang Bumiller
2023-06-05 7:54 ` Dominik Csapak [this message]
2023-06-05 7:59 ` Wolfgang Bumiller
2023-06-05 8:03 ` [pve-devel] applied: " Wolfgang Bumiller
2023-05-12 12:23 ` [pve-devel] [PATCH http-server 1/2] proxy request: forward json content type and parameters Dominik Csapak
2023-06-05 8:42 ` Wolfgang Bumiller
2023-05-12 12:23 ` [pve-devel] [PATCH http-server 2/2] use proper arrays for array parameter Dominik Csapak
2023-05-12 12:23 ` [pve-devel] [PATCH guest-common 1/1] vzdump: change 'exclude-path' from alist to an array format Dominik Csapak
2023-06-05 8:37 ` [pve-devel] [PATCH guest-common 1/1] vzdump: change 'exclude-path' from alist to an array formaty Wolfgang Bumiller
2023-05-12 12:23 ` [pve-devel] [PATCH qemu-server 1/1] api: switch agent api call to 'array' type Dominik Csapak
2023-06-05 8:38 ` Wolfgang Bumiller
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=fec9228c-13b7-15a7-f6b0-1ab8583c9a5d@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=w.bumiller@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal