[pve-devel] [PATCH v2 container 1/1] replace read_password with param_mapping

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jun 19 13:12:35 CEST 2018


On 6/15/18 3:28 PM, Dominik Csapak wrote:
> with this we do not need Term::ReadLine anymore
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/PVE/CLI/pct.pm | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index 897d595..ede8a4f 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);
> @@ -76,14 +75,14 @@ __PACKAGE__->register_method ({
>  	return undef;
>      }});
>  
> -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;
> +sub param_mapping {
> +    my ($name) = @_;
> +
> +    my $mapping = {
> +	'create_vm' => [ PVE::CLIHandler::get_standard_mapping('pve-password') ],
> +    };
> +
> +    return $mapping->{name};
>  }
>  
>  sub string_param_file_mapping {
> 

param_mapping has precedence over string_param_file_mapping also used by pct,
so this breaks things...
You would need to integrate the part from string_param_file_mapping into the
param_mapping function, or?




More information about the pve-devel mailing list