5
0
mirror of git://git.proxmox.com/git/pve-common.git synced 2024-12-22 21:33:47 +03:00

rename $pwcallback to $read_password_func

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2018-03-02 12:37:21 +01:00 committed by Wolfgang Bumiller
parent 94e0f9540f
commit 8d3eb3ce17
2 changed files with 10 additions and 10 deletions

View File

@ -457,7 +457,7 @@ sub setup_environment {
}
my $handle_cmd = sub {
my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_;
my ($args, $read_password_func, $preparefunc, $param_mapping_func) = @_;
$cmddef->{help} = [ __PACKAGE__, 'help', ['extra-args'] ];
@ -489,13 +489,13 @@ my $handle_cmd = sub {
$abort->("unknown command '$cmd_str'") if !$class;
my $prefix = "$exename $cmd_str";
my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $pwcallback, $param_mapping_func);
my $res = $class->cli_handler($prefix, $name, $cmd_args, $arg_param, $uri_param, $read_password_func, $param_mapping_func);
&$outsub($res) if $outsub;
};
my $handle_simple_cmd = sub {
my ($args, $pwcallback, $preparefunc, $param_mapping_func) = @_;
my ($args, $read_password_func, $preparefunc, $param_mapping_func) = @_;
my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef};
die "no class specified" if !$class;
@ -524,7 +524,7 @@ my $handle_simple_cmd = sub {
&$preparefunc() if $preparefunc;
my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $pwcallback, $param_mapping_func);
my $res = $class->cli_handler($name, $name, \@ARGV, $arg_param, $uri_param, $read_password_func, $param_mapping_func);
&$outsub($res) if $outsub;
};
@ -545,7 +545,7 @@ sub run_cli_handler {
my $preparefunc = $params{prepare};
my $pwcallback = $class->can('read_password');
my $read_password_func = $class->can('read_password');
my $param_mapping_func = $class->can('string_param_file_mapping');
$exename = &$get_exe_name($class);
@ -556,9 +556,9 @@ sub run_cli_handler {
$cmddef = ${"${class}::cmddef"};
if (ref($cmddef) eq 'ARRAY') {
&$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func);
&$handle_simple_cmd(\@ARGV, $read_password_func, $preparefunc, $param_mapping_func);
} else {
&$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $param_mapping_func);
&$handle_cmd(\@ARGV, $read_password_func, $preparefunc, $param_mapping_func);
}
exit 0;

View File

@ -699,13 +699,13 @@ my $replace_file_names_with_contents = sub {
};
sub cli_handler {
my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $pwcallback, $param_mapping_func) = @_;
my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $read_password_func, $param_mapping_func) = @_;
my $info = $self->map_method_by_name($name);
my $res;
eval {
my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $pwcallback);
my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $arg_param, $fixed_param, $read_password_func);
if (defined($param_mapping_func)) {
my $param_mapping_hash = $compute_param_mapping_hash->(&$param_mapping_func($name));
@ -719,7 +719,7 @@ sub cli_handler {
die $err if !$ec || $ec ne "PVE::Exception" || !$err->is_param_exc();
$err->{usage} = $self->usage_str($name, $prefix, $arg_param, $fixed_param, 'short', $pwcallback, $param_mapping_func);
$err->{usage} = $self->usage_str($name, $prefix, $arg_param, $fixed_param, 'short', $read_password_func, $param_mapping_func);
die $err;
}