[pve-devel] [PATCH common 4/4] CLIHandler: add standard mapping for password parameter

Dominik Csapak d.csapak at proxmox.com
Fri Jun 15 15:28:44 CEST 2018


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 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 b677105..98972b7 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 => '<password>',
+	interactive => 1,
+	func => sub {
+	    my ($value) = @_;
+	    return $value if $value;
+	    return PVE::PTY::get_confirmed_password();
+	},
+    },
+};
 
 sub get_standard_mapping {
     my ($name, $base) = @_;
-- 
2.11.0




More information about the pve-devel mailing list