public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api 1/4] partially fix #2077: pmgconfig: remove dependency on Term::ReadLine
Date: Mon, 22 Sep 2025 11:47:26 +0200	[thread overview]
Message-ID: <20250922114726.038efb75@rosa.proxmox.com> (raw)
In-Reply-To: <20250918142052.131956-2-f.ebner@proxmox.com>

gave this a spin on a testsetup with the reproducer from:
https://forum.proxmox.com/threads/.170001/
(via https://bugzilla.proxmox.com/show_bug.cgi?id=6748)

issue was present without the patch.
with pve-common containing:
https://lore.proxmox.com/pve-devel/20250918135215.95188-2-f.ebner@proxmox.com/
and this patch applied - I got past the error-message and to the question
for EAB credentials.

Consider this:
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>

On Thu, 18 Sep 2025 16:19:41 +0200
Fiona Ebner <f.ebner@proxmox.com> wrote:

> As a side-effect, this also fixes #6748.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  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;



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


  reply	other threads:[~2025-09-22  9:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 14:19 [pmg-devel] [PATCH-SERIES pmg-api 0/3] fix #2077: " Fiona Ebner
2025-09-18 14:19 ` [pmg-devel] [PATCH pmg-api 1/4] partially fix #2077: pmgconfig: " Fiona Ebner
2025-09-22  9:47   ` Stoiko Ivanov [this message]
2025-09-18 14:19 ` [pmg-devel] [PATCH pmg-api 2/4] partially fix #2077: pmgcm: " Fiona Ebner
2025-09-22  9:46   ` Stoiko Ivanov
2025-09-18 14:19 ` [pmg-devel] [PATCH pmg-api 3/4] partially fix #2077: pmgsh: " Fiona Ebner
2025-09-18 20:58   ` Stoiko Ivanov
2025-09-19  8:41     ` Fiona Ebner
2025-09-22  9:47       ` Stoiko Ivanov
2025-09-18 14:19 ` [pmg-devel] [RFC pmg-api 4/4] d/control: remove libterm-readline-gnu-perl dependency Fiona Ebner

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=20250922114726.038efb75@rosa.proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=f.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal