[PATCH manager 1/1] use Term::ReadLine->new() only once

Sebastian Luksch bugzilla.proxmox.com at lookshe.org
Tue Sep 2 20:20:30 CEST 2025


---
 PVE/CLI/pvenode.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/PVE/CLI/pvenode.pm b/PVE/CLI/pvenode.pm
index 76b05887..466170f4 100644
--- a/PVE/CLI/pvenode.pm
+++ b/PVE/CLI/pvenode.pm
@@ -97,6 +97,7 @@ __PACKAGE__->register_method({
         my ($param) = @_;
 
         my $custom_directory = 0;
+        my $term = Term::ReadLine->new('pvenode');
         if (!$param->{directory}) {
             my $directories = PVE::API2::ACMEAccount->get_directories({});
             print "Directory endpoints:\n";
@@ -108,7 +109,6 @@ __PACKAGE__->register_method({
             }
             print $i, ") Custom\n";
 
-            my $term = Term::ReadLine->new('pvenode');
             my $get_dir_selection = sub {
                 my $selection = $term->readline("Enter selection: ");
                 if ($selection =~ /^(\d+)$/) {
@@ -137,7 +137,6 @@ __PACKAGE__->register_method({
         if ($meta->{termsOfService}) {
             my $tos = $meta->{termsOfService};
             print "Terms of Service: $tos\n";
-            my $term = Term::ReadLine->new('pvenode');
             my $agreed = $term->readline('Do you agree to the above terms? [y|N]: ');
             die "Cannot continue without agreeing to ToS, aborting.\n"
                 if ($agreed !~ /^y$/i);
@@ -149,7 +148,6 @@ __PACKAGE__->register_method({
 
         my $eab_enabled = $meta->{externalAccountRequired};
         if (!$eab_enabled && $custom_directory) {
-            my $term = Term::ReadLine->new('pvenode');
             my $agreed =
                 $term->readline('Do you want to use external account binding? [y|N]: ');
             $eab_enabled = ($agreed =~ /^y$/i);
@@ -158,7 +156,6 @@ __PACKAGE__->register_method({
         }
         if ($eab_enabled) {
             print "You should have received a key id and a key from your CA.\n";
-            my $term = Term::ReadLine->new('pvenode');
             my $eab_kid = $term->readline('Enter EAB key id: ');
             my $eab_hmac_key = $term->readline('Enter EAB key: ');
 
-- 
2.30.2




More information about the pve-devel mailing list