From: Dominik Csapak Date: Fri, 15 Jun 2018 13:28:44 +0000 (+0200) Subject: CLIHandler: add standard mapping for password parameter X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=0da61ab3c343ee60c6d3841de10328ab89158b31;p=pve-common.git CLIHandler: add standard mapping for password parameter Signed-off-by: Dominik Csapak --- diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm index 810467d..1ad1b65 100644 --- a/src/PVE/CLIHandler.pm +++ b/src/PVE/CLIHandler.pm @@ -6,6 +6,7 @@ use warnings; use PVE::SafeSyslog; use PVE::Exception qw(raise raise_param_exc); use PVE::RESTHandler; +use PVE::PTY; use PVE::INotify; use base qw(PVE::RESTHandler); @@ -69,7 +70,18 @@ my $get_commands = sub { my $complete_command_names = sub { $get_commands->($cmddef) }; -my $standard_mappings = { }; +my $standard_mappings = { + 'pve-password' => { + name => 'password', + desc => '', + interactive => 1, + func => sub { + my ($value) = @_; + return $value if $value; + return PVE::PTY::get_confirmed_password(); + }, + }, +}; sub get_standard_mapping { my ($name, $base) = @_;