public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] pmgsh: fix calling the api paths directly
@ 2023-07-03  8:28 Dominik Csapak
  2023-07-03  8:30 ` Dominik Csapak
  2023-07-03  9:15 ` [pmg-devel] applied: " Stoiko Ivanov
  0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2023-07-03  8:28 UTC (permalink / raw)
  To: pmg-devel

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-07 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03  8:28 [pmg-devel] [PATCH pmg-api] pmgsh: fix calling the api paths directly Dominik Csapak
2023-07-03  8:30 ` Dominik Csapak
2023-07-03  9:15 ` [pmg-devel] applied: " Stoiko Ivanov
2023-07-07 16:59   ` Stoiko Ivanov

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