From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] applied: [PATCH pmg-api] api: nodes: add definedness check to avoid perl warning
Date: Tue, 15 Jun 2021 17:23:53 +0200 [thread overview]
Message-ID: <20210615172353.2307837b@rosa.proxmox.com> (raw)
In-Reply-To: <20210615132752.191661-1-f.ebner@proxmox.com>
On Tue, 15 Jun 2021 15:27:52 +0200
Fabian Ebner <f.ebner@proxmox.com> wrote:
> also add the missing import for 'raise_perm_exc' to avoid having the error about
> the undefined subroutine instead of the actual error.
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> src/PMG/API2/Nodes.pm | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/PMG/API2/Nodes.pm b/src/PMG/API2/Nodes.pm
> index f9ccfae..e41194b 100644
> --- a/src/PMG/API2/Nodes.pm
> +++ b/src/PMG/API2/Nodes.pm
> @@ -6,6 +6,7 @@ use Time::Local qw(timegm_nocheck);
> use Filesys::Df;
> use Data::Dumper;
>
> +use PVE::Exception qw(raise_perm_exc);
> use PVE::INotify;
> use PVE::RESTHandler;
> use PVE::JSONSchema qw(get_standard_option);
> @@ -428,7 +429,9 @@ __PACKAGE__->register_method ({
> my $restenv = PMG::RESTEnvironment->get();
> my $user = $restenv->get_user();
>
> - raise_perm_exc('user != root@pam') if $param->{cmd} eq 'upgrade' && $user ne 'root@pam';
> + if (defined($param->{cmd}) && $param->{cmd} eq 'upgrade' && $user ne 'root@pam') {
> + raise_perm_exc('user != root@pam');
> + }
>
> my $ticket = PMG::Ticket::assemble_vnc_ticket($user, $authpath);
>
Huge Thanks for catching this - gave it a quick spin on my testsetup and
applied the patch!
prev parent reply other threads:[~2021-06-15 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 13:27 [pmg-devel] " Fabian Ebner
2021-06-15 15:23 ` Stoiko Ivanov [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=20210615172353.2307837b@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=f.ebner@proxmox.com \
--cc=pmg-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 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.