From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] fix #4815: pmgsh: declare rpcenv on top
Date: Mon, 3 Jul 2023 10:48:01 +0200 [thread overview]
Message-ID: <20230703084801.30822-1-s.ivanov@proxmox.com> (raw)
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
next reply other threads:[~2023-07-03 8:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 8:48 Stoiko Ivanov [this message]
2023-07-03 9:05 ` Fiona Ebner
2023-07-03 9:13 ` 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=20230703084801.30822-1-s.ivanov@proxmox.com \
--to=s.ivanov@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