]> git.proxmox.com Git - pve-common.git/commit
remove read_password_func from cli handler
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 21 Jun 2018 12:36:52 +0000 (14:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Jun 2018 10:37:20 +0000 (12:37 +0200)
commit4842b6510546f76906b216cb05d98ec9768f9e8e
tree19baa205bebbf7839659dfb0687ade77bca1de7b
parent3c3d1e07c805630a5811f6d5db4f14dc80a52fc0
remove read_password_func from cli handler

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@proxmox.com>
src/PVE/CLIHandler.pm
src/PVE/JSONSchema.pm
src/PVE/RESTHandler.pm