public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Philipp Hufnagl <p.hufnagl@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH storage] fix #5008: prevent adding pbs storage with invalid namespace
Date: Wed, 15 Nov 2023 11:01:35 +0100	[thread overview]
Message-ID: <fb12ecd5-0b61-43f5-9c9e-e0d2bcb62294@proxmox.com> (raw)
In-Reply-To: <0c9cd0e3-fecc-453c-9238-8dc249b0a0d0@proxmox.com>

Am 15.11.23 um 10:37 schrieb Philipp Hufnagl:
> 
> 
> On 11/15/23 09:31, Fiona Ebner wrote:
>> Am 14.11.23 um 15:27 schrieb Philipp Hufnagl:
>>> @@ -826,10 +837,18 @@ sub activate_storage {
>>>      die "$storeid: $@" if $@;
>>>  
>>>      my $datastore = $scfg->{datastore};
>>> +    my $namespace = $scfg->{namespace};
>>>  
>>>      for my $ds (@$datastores) {
>>>  	if ($ds->{store} eq $datastore) {
>>> -	    return 1;
>>> +	    return 1 if !defined($namespace);
>>> +	    my $namespaces = eval { scan_namespaces($scfg, $datastore, $password) };
>>
>> Why use eval and ignore the error here? Like that users (and we) won't
>> know if the api request or connection failed and just get the error
>> message from below about permissions/existence then.
> 
> I tried to mimic the behavior from scan_datastores(). Did I make a
> mistake there? Is the way of scan_datastores() deprecated or bad practice?
>>

There, the error is not ignored, but propagated:

>     my $datastores = eval { scan_datastores($scfg, $password) };
>     die "$storeid: $@" if $@;




      parent reply	other threads:[~2023-11-15 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 14:27 Philipp Hufnagl
2023-11-15  8:31 ` Fiona Ebner
2023-11-15  9:37   ` Philipp Hufnagl
2023-11-15  9:52     ` Thomas Lamprecht
2023-11-15 10:05       ` Philipp Hufnagl
2023-11-15 10:09         ` Thomas Lamprecht
2023-11-15 10:40           ` Philipp Hufnagl
2023-11-15 10:01     ` Fiona Ebner [this message]

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=fb12ecd5-0b61-43f5-9c9e-e0d2bcb62294@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=p.hufnagl@proxmox.com \
    --cc=pve-devel@lists.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