[pve-devel] [PATCH V2 pve-common 4/6] rename $pwcallback to $read_password_func

Dietmar Maurer dietmar at proxmox.com
Fri Mar 2 12:37:21 CET 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/CLIHandler.pm  | 14 +++++++-------
 src/PVE/RESTHandler.pm |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index 33b7aca..2d77145 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -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;
diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index 55a7f9a..0a64158 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -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;
     }
-- 
2.11.0




More information about the pve-devel mailing list