[pve-devel] applied: [PATCH v2 storage 1/1] replace read_password with param_mapping

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


On 6/15/18 3:28 PM, Dominik Csapak wrote:
> we only need this for cifs as this is the only type
> of storage where we expect a password
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/CLI/pvesm.pm | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
> index 5774364..d95b5f5 100755
> --- a/PVE/CLI/pvesm.pm
> +++ b/PVE/CLI/pvesm.pm
> @@ -27,8 +27,21 @@ my $KNOWN_EXPORT_FORMATS = ['raw+size', 'tar+size', 'qcow2+size', 'vmdk+size', '
>  
>  my $nodename = PVE::INotify::nodename();
>  
> -sub read_password {
> -    return PVE::PTY::read_password("Enter Password: ");
> +sub param_mapping {
> +    my ($name) = @_;
> +
> +    my $password_map = PVE::CLIHandler::get_standard_mapping('pve-password', {
> +	func => sub {
> +	    my ($value) = @_;
> +	    return $value if $value;
> +	    return PVE::PTY::read_password("Enter Password: ");
> +	},
> +    });
> +    my $mapping = {
> +	'cifsscan' => [ $password_map ],
> +	'create' => [ $password_map ],
> +    };
> +    return $mapping->{$name};
>  }
>  
>  sub setup_environment {
> 

applied, with pve-common version dependency update



More information about the pve-devel mailing list