[pve-devel] [pve-container PATCH V2] Refactoring read_password.
Wolfgang Link
w.link at proxmox.com
Fri Jan 13 13:36:44 CET 2017
We use this function in 3 different packets with the same code.
It will moved to the CLIHandler, because we need it only on the command line.
---
src/PVE/CLI/pct.pm | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 4ffb8db..35f705b 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -6,7 +6,6 @@ use warnings;
use POSIX;
use Fcntl;
use File::Copy 'copy';
-use Term::ReadLine;
use PVE::SafeSyslog;
use PVE::Tools qw(extract_param);
@@ -77,13 +76,7 @@ __PACKAGE__->register_method ({
}});
sub read_password {
- my $term = new Term::ReadLine ('pct');
- my $attribs = $term->Attribs;
- $attribs->{redisplay_function} = $attribs->{shadow_redisplay};
- my $input = $term->readline('Enter password: ');
- my $conf = $term->readline('Retype password: ');
- die "Passwords do not match.\n" if ($input ne $conf);
- return $input;
+ return PVE::CLIHandler::read_password_impl('pct', 1);
}
sub string_param_file_mapping {
--
2.1.4
More information about the pve-devel
mailing list