From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 426321FF17E for ; Thu, 18 Sep 2025 16:21:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 18F662009; Thu, 18 Sep 2025 16:21:29 +0200 (CEST) From: Fiona Ebner To: pmg-devel@lists.proxmox.com Date: Thu, 18 Sep 2025 16:19:41 +0200 Message-ID: <20250918142052.131956-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250918142052.131956-1-f.ebner@proxmox.com> References: <20250918142052.131956-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758205246453 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api 1/4] partially fix #2077: pmgconfig: remove dependency on Term::ReadLine X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" As a side-effect, this also fixes #6748. Signed-off-by: Fiona Ebner --- src/PMG/CLI/pmgconfig.pm | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/PMG/CLI/pmgconfig.pm b/src/PMG/CLI/pmgconfig.pm index 9f3c679..e658806 100644 --- a/src/PMG/CLI/pmgconfig.pm +++ b/src/PMG/CLI/pmgconfig.pm @@ -5,13 +5,12 @@ use warnings; use IO::File; use Data::Dumper; -use Term::ReadLine; - use PVE::SafeSyslog; use PVE::Tools qw(extract_param); use PVE::INotify; use PVE::CLIHandler; use PVE::JSONSchema qw(get_standard_option); +use PVE::PTY; use PMG::RESTEnvironment; use PMG::RuleDB; @@ -277,13 +276,12 @@ __PACKAGE__->register_method({ } print $i, ") Custom\n"; - my $term = Term::ReadLine->new('pmgconfig'); my $get_dir_selection = sub { - my $selection = $term->readline("Enter selection: "); + my $selection = PVE::PTY::read_line("Enter selection: "); if ($selection =~ /^(\d+)$/) { $selection = $1; if ($selection == $i) { - $param->{directory} = $term->readline("Enter custom URL: "); + $param->{directory} = PVE::PTY::read_line("Enter custom URL: "); return; } elsif ($selection < $i && $selection >= 0) { $param->{directory} = $directories->[$selection]->{url}; @@ -307,8 +305,7 @@ __PACKAGE__->register_method({ if ($meta->{termsOfService}) { my $tos = $meta->{termsOfService}; print "Terms of Service: $tos\n"; - my $term = Term::ReadLine->new('pmgconfig'); - my $agreed = $term->readline('Do you agree to the above terms? [y|N]: '); + my $agreed = PVE::PTY::read_line('Do you agree to the above terms? [y|N]: '); die "Cannot continue without agreeing to ToS, aborting.\n" if ($agreed !~ /^y$/i); @@ -319,18 +316,16 @@ __PACKAGE__->register_method({ my $eab_enabled = $meta->{externalAccountRequired}; if (!$eab_enabled && $custom_directory) { - my $term = Term::ReadLine->new('pmgconfig'); my $agreed = - $term->readline('Do you want to use external account binding? [y|N]: '); + PVE::PTY::read_line('Do you want to use external account binding? [y|N]: '); $eab_enabled = ($agreed =~ /^y$/i); } elsif ($eab_enabled) { print "The CA requires external account binding.\n"; } if ($eab_enabled) { print "You should have received a key id and a key from your CA.\n"; - my $term = Term::ReadLine->new('pmgconfig'); - my $eab_kid = $term->readline('Enter EAB key id: '); - my $eab_hmac_key = $term->readline('Enter EAB key: '); + my $eab_kid = PVE::PTY::read_line('Enter EAB key id: '); + my $eab_hmac_key = PVE::PTY::read_line('Enter EAB key: '); $param->{'eab-kid'} = $eab_kid; $param->{'eab-hmac-key'} = $eab_hmac_key; -- 2.47.3 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel