all lists on 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

* Re: [pmg-devel] [PATCH pmg-api] pmgsh: fix calling the api paths directly
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2023-07-03  8:30 UTC (permalink / raw)
  To: pmg-devel

forgot to add the trailer:

Fixes: 1583283 ("pmgsh: initialize RPC/REST environment late")




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

* [pmg-devel] applied: [PATCH pmg-api] pmgsh: fix calling the api paths directly
  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 ` Stoiko Ivanov
  2023-07-07 16:59   ` Stoiko Ivanov
  1 sibling, 1 reply; 4+ messages in thread
From: Stoiko Ivanov @ 2023-07-03  9:15 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: pmg-devel

Thanks for the fix!
Applied with bug-reference and Fixes trailer added!


On Mon,  3 Jul 2023 10:28:19 +0200
Dominik Csapak <d.csapak@proxmox.com> wrote:

> 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');





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

* Re: [pmg-devel] applied: [PATCH pmg-api] pmgsh: fix calling the api paths directly
  2023-07-03  9:15 ` [pmg-devel] applied: " Stoiko Ivanov
@ 2023-07-07 16:59   ` Stoiko Ivanov
  0 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2023-07-07 16:59 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: pmg-devel

On Mon, 3 Jul 2023 11:15:48 +0200
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:

> Thanks for the fix!
> Applied with bug-reference and Fixes trailer added!
for the record - also cherry-picked it to stable-7 just now as the issue
was present there as well

> 
> 
> On Mon,  3 Jul 2023 10:28:19 +0200
> Dominik Csapak <d.csapak@proxmox.com> wrote:
> 
> > 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');  
> 
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
> 
> 





^ 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 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