]> git.proxmox.com Git - pve-common.git/commitdiff
CLIHandler: add standard mapping for password parameter
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 15 Jun 2018 13:28:44 +0000 (15:28 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Jun 2018 09:56:00 +0000 (11:56 +0200)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/CLIHandler.pm

index 810467d46eb28db8ac2a997901a0a22cb1b787ea..1ad1b65e9e352aeb7780fbc61ad6114214c7845b 100644 (file)
@@ -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) = @_;