mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-04-30 12:24:56 +00:00
replace read_password with param_mapping in pvesh
and use get_standard_mapping from CLIHandler Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
667f0037df
commit
be968cb617
24
bin/pvesh
24
bin/pvesh
@ -16,6 +16,7 @@ use PVE::SafeSyslog;
|
|||||||
use PVE::Cluster;
|
use PVE::Cluster;
|
||||||
use PVE::INotify;
|
use PVE::INotify;
|
||||||
use PVE::RPCEnvironment;
|
use PVE::RPCEnvironment;
|
||||||
|
use PVE::CLIHandler;
|
||||||
use PVE::API2Tools;
|
use PVE::API2Tools;
|
||||||
use PVE::API2;
|
use PVE::API2;
|
||||||
use JSON;
|
use JSON;
|
||||||
@ -184,23 +185,10 @@ sub abs_path {
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $read_password = sub {
|
my $param_mapping = sub {
|
||||||
my $attribs = $term->Attribs;
|
my ($name) = @_;
|
||||||
my $old = $attribs->{redisplay_function};
|
|
||||||
$attribs->{redisplay_function} = $attribs->{shadow_redisplay};
|
|
||||||
my $input = $term->readline('password: ');
|
|
||||||
my $conf = $term->readline('Retype new password: ');
|
|
||||||
$attribs->{redisplay_function} = $old;
|
|
||||||
|
|
||||||
# remove password from history
|
return [PVE::CLIHandler::get_standard_mapping('pve-password')];
|
||||||
if ($term->Features->{autohistory}) {
|
|
||||||
my $historyPosition = $term->where_history();
|
|
||||||
$term->remove_history($historyPosition);
|
|
||||||
$term->remove_history($historyPosition - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
die "Passwords do not match.\n" if ($input ne $conf);
|
|
||||||
return $input;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sub reverse_map_cmd {
|
sub reverse_map_cmd {
|
||||||
@ -279,7 +267,7 @@ sub call_method {
|
|||||||
my ($node, $remip) = check_proxyto($info, $uri_param);
|
my ($node, $remip) = check_proxyto($info, $uri_param);
|
||||||
return proxy_handler($node, $remip, $dir, $cmd, $args) if $node;
|
return proxy_handler($node, $remip, $dir, $cmd, $args) if $node;
|
||||||
|
|
||||||
my $data = $handler->cli_handler("$cmd $dir", $info->{name}, $args, [], $uri_param, $read_password);
|
my $data = $handler->cli_handler("$cmd $dir", $info->{name}, $args, [], $uri_param, $param_mapping);
|
||||||
|
|
||||||
return if $nooutput;
|
return if $nooutput;
|
||||||
|
|
||||||
@ -450,7 +438,7 @@ sub list_dir {
|
|||||||
return proxy_handler($node, $remip, $dir, 'ls', $args) if $node;
|
return proxy_handler($node, $remip, $dir, 'ls', $args) if $node;
|
||||||
|
|
||||||
|
|
||||||
my $data = $handler->cli_handler("ls $dir", $info->{name}, $args, [], $uri_param, $read_password);
|
my $data = $handler->cli_handler("ls $dir", $info->{name}, $args, [], $uri_param, $param_mapping);
|
||||||
my $lnk = PVE::JSONSchema::method_get_child_link($info);
|
my $lnk = PVE::JSONSchema::method_get_child_link($info);
|
||||||
my $children = extract_children($lnk, $data);
|
my $children = extract_children($lnk, $data);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user