From 0da61ab3c343ee60c6d3841de10328ab89158b31 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 15 Jun 2018 15:28:44 +0200 Subject: [PATCH 1/1] CLIHandler: add standard mapping for password parameter Signed-off-by: Dominik Csapak --- src/PVE/CLIHandler.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) = @_; -- 2.39.2