[pve-devel] applied: [PATCH container v3] replace read_password with param_mapping

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 27 16:12:10 CEST 2018


On 6/25/18 12:30 PM, Dominik Csapak wrote:
> with this we do not need Term::ReadLine anymore
> and we can merge the string_param_file_mapping into the param_mapping
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> this is the missing v3 of the container read_password patch
>  src/PVE/CLI/pct.pm | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index 897d595..16cd4ec 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,24 +75,17 @@ __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 string_param_file_mapping {
> +sub param_mapping {
>      my ($name) = @_;
>  
>      my $mapping = {
> -	'create_vm' => ['ssh-public-keys'],
> +	'create_vm' => [
> +	    PVE::CLIHandler::get_standard_mapping('pve-password'),
> +	    'ssh-public-keys',
> +	],
>      };
>  
> -    return defined($mapping->{$name}) ? $mapping->{$name} : [];
> +    return $mapping->{$name};
>  }
>  
>  __PACKAGE__->register_method ({
> 

applied, with pve-common version dependency update




More information about the pve-devel mailing list