[pve-devel] applied: [PATCH common v5] remove read_password_func from cli handler
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jun 27 16:11:41 CEST 2018
On 6/21/18 2:36 PM, Dominik Csapak wrote:
> we have a param_mapping now, with which we can impement that
>
> e.g. instead of using:
>
> sub read_password {
> # read password
> }
>
> we can do:
>
> sub param_mapping {
> my ($name) = @_;
>
> my $password_map = ['password', sub{
> # read password
> }, '<password', 1];
>
> my $mapping = {
> 'apicall1' => [$password_map],
> 'apicall2' => [$password_map],
> ...
> };
>
> return $mapping->{$name};
> }
>
> this has the advantage that we can use different subs for different
> api calls (e.g. pveum passwd vs pveum ticket)
>
> if a CLIHandler implemenation still has a read_password sub and no
> param_mapping, we generate one for them with read_password as the
> sub for the standard mapping 'pve-password'
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> changes from v4:
> * used correct parenthesis with string_param_mapping () vs {}
> * avoid using a my $foo = ... if CLAUSE; construct
applied, with rename fixup and a break on older pve-manager and pmg-api
More information about the pve-devel
mailing list