* [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top
@ 2023-07-03 8:48 Stoiko Ivanov
2023-07-03 9:05 ` Fiona Ebner
0 siblings, 1 reply; 3+ messages in thread
From: Stoiko Ivanov @ 2023-07-03 8:48 UTC (permalink / raw)
To: pmg-devel
and drop duplicate setup_default_cli_env and initlog invocation
Fixes: 1583283557956a431c4afe86d243c6fbc177034b
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
quickly tested on my box pmgsh works and sbuild works as well with
the patch
src/bin/pmgsh | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/bin/pmgsh b/src/bin/pmgsh
index f9816cd..475e886 100755
--- a/src/bin/pmgsh
+++ b/src/bin/pmgsh
@@ -37,6 +37,8 @@ sub print_usage {
my $disable_proxy = 0;
my $opt_nooutput = 0;
+my $rpcenv;
+
my $cmd = shift;
my $optmatch;
@@ -62,6 +64,7 @@ if ($cmd) {
exit 0;
} elsif ($cmd =~ /^(?:ls|get|create|set|delete|help)$/) {
PMG::RESTEnvironment->setup_default_cli_env(); # only set up once actually required
+ $rpcenv = PMG::RESTEnvironment->get();
initlog($ENV{PVE_LOG_ID} || 'pmgsh');
pmg_command([ $cmd, @ARGV], $opt_nooutput);
exit(0);
@@ -76,11 +79,6 @@ if (scalar (@ARGV) != 0) {
exit(-1);
}
-# 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";
my $term = new Term::ReadLine('pmgsh');
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top
2023-07-03 8:48 [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top Stoiko Ivanov
@ 2023-07-03 9:05 ` Fiona Ebner
2023-07-03 9:13 ` Stoiko Ivanov
0 siblings, 1 reply; 3+ messages in thread
From: Fiona Ebner @ 2023-07-03 9:05 UTC (permalink / raw)
To: Stoiko Ivanov, pmg-devel
Am 03.07.23 um 10:48 schrieb Stoiko Ivanov:
>
> -# 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');
> -
Now it's not initialized for the case when no command is specified, i.e.
when entering the PMG shell?
> print "entering PMG shell - type 'help' for help\n";
>
> my $term = new Term::ReadLine('pmgsh');
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top
2023-07-03 9:05 ` Fiona Ebner
@ 2023-07-03 9:13 ` Stoiko Ivanov
0 siblings, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2023-07-03 9:13 UTC (permalink / raw)
To: Fiona Ebner; +Cc: pmg-devel
On Mon, 3 Jul 2023 11:05:05 +0200
Fiona Ebner <f.ebner@proxmox.com> wrote:
> Am 03.07.23 um 10:48 schrieb Stoiko Ivanov:
> >
> > -# 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');
> > -
>
> Now it's not initialized for the case when no command is specified, i.e.
> when entering the PMG shell?
Thanks for noticing! I'll go with Dominik's fix for the issue :)
>
> > print "entering PMG shell - type 'help' for help\n";
> >
> > my $term = new Term::ReadLine('pmgsh');
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-03 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 8:48 [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top Stoiko Ivanov
2023-07-03 9:05 ` Fiona Ebner
2023-07-03 9:13 ` Stoiko Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox