[pve-devel] [PATCH storage 1/1] replace read_password with param_mapping
Dominik Csapak
d.csapak at proxmox.com
Tue Jun 12 12:33:50 CEST 2018
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 at proxmox.com>
---
PVE/CLI/pvesm.pm | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index 5774364..5113715 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -27,8 +27,19 @@ 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 = [ 'password', sub {
+ my ($value) = @_;
+ return $value if $value;
+ return PVE::PTY::read_password("Enter Password: ");
+ }, '<password>', 1];
+ my $mapping = {
+ 'cifsscan' => [ $password_map ],
+ 'create' => [ $password_map ],
+ };
+ return $mapping->{$name};
}
sub setup_environment {
--
2.11.0
More information about the pve-devel
mailing list