replace read_password with param_mapping

we only need this for cifs as this is the only type
of storage where we expect a password

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2018-06-15 15:28:48 +02:00
committed by Thomas Lamprecht
parent 8b3d5c1f12
commit 42f2c57dfa

View File

@ -27,8 +27,21 @@ my $KNOWN_EXPORT_FORMATS = ['raw+size', 'tar+size', 'qcow2+size', 'vmdk+size', '
my $nodename = PVE::INotify::nodename();
sub read_password {
return PVE::PTY::read_password("Enter Password: ");
sub param_mapping {
my ($name) = @_;
my $password_map = PVE::CLIHandler::get_standard_mapping('pve-password', {
func => sub {
my ($value) = @_;
return $value if $value;
return PVE::PTY::read_password("Enter Password: ");
},
});
my $mapping = {
'cifsscan' => [ $password_map ],
'create' => [ $password_map ],
};
return $mapping->{$name};
}
sub setup_environment {