From: Dominik Csapak <d.csapak@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] pmgsh: fix calling the api paths directly
Date: Mon, 3 Jul 2023 10:28:19 +0200 [thread overview]
Message-ID: <20230703082819.2383611-1-d.csapak@proxmox.com> (raw)
if we get a command directly, we don't initialize the $rpcenv
variable anymore.
To fix it, make it a local variable of the pmg_command function.
We now make one extra '->get()' call per command (as opposed to
once per program), but that shouldn't cost us anything really.
Reported in the forum: https://forum.proxmox.com/threads/pmgsh-failing.130008/
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/bin/pmgsh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pmgsh b/src/bin/pmgsh
index f9816cd..7499c42 100755
--- a/src/bin/pmgsh
+++ b/src/bin/pmgsh
@@ -78,7 +78,6 @@ if (scalar (@ARGV) != 0) {
# only set up once actually required allows calling verifyapi in restriced clean sbuild env
PMG::RESTEnvironment->setup_default_cli_env();
-my $rpcenv = PMG::RESTEnvironment->get();
initlog($ENV{PVE_LOG_ID} || 'pmgsh');
print "entering PMG shell - type 'help' for help\n";
@@ -451,6 +450,7 @@ sub list_dir {
sub pmg_command {
my ($args, $nooutput) = @_;
+ my $rpcenv = PMG::RESTEnvironment->get();
$rpcenv->init_request();
my $ticket = PMG::Ticket::assemble_ticket('root@pam');
--
2.30.2
next reply other threads:[~2023-07-03 8:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 8:28 Dominik Csapak [this message]
2023-07-03 8:30 ` Dominik Csapak
2023-07-03 9:15 ` [pmg-devel] applied: " Stoiko Ivanov
2023-07-07 16:59 ` Stoiko Ivanov
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=20230703082819.2383611-1-d.csapak@proxmox.com \
--to=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox