Re: [pve-devel] [PATCH storage 03/11] Add helper function for extract CIFS credentials.
On Tue, Mar 13, 2018 at 03:23:10PM +0100, Thomas Lamprecht wrote: > On 03/13/2018 03:11 PM, Wolfgang Link wrote: > > --- > > PVE/API2/Storage/Config.pm | 16 > > 1 file changed, 16 insertions(+) > > > > diff --git a/PVE/API2/Storage/Config.pm b/PVE/API2/Storage/Config.pm > > index aa8c931..fa8d4de 100755 > > --- a/PVE/API2/Storage/Config.pm > > +++ b/PVE/API2/Storage/Config.pm > > @@ -12,6 +12,7 @@ use HTTP::Status qw(:constants); > > use Storable qw(dclone); > > use PVE::JSONSchema qw(get_standard_option); > > use PVE::RPCEnvironment; > > +use Term::ReadLine; > > > please do not use Term::ReadLine anymore, rather use Wolfgang B.'s > nice PTY module, i.e.: Also this should be CLI-only, and therefore handled in in CLI/pvesm.pm via the new parameter mapping functionality instead of having this in API2/Storage/Config.pm In the API, just don't set a password if it hasn't been provided. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH storage 03/11] Add helper function for extract CIFS credentials.
On 03/13/2018 03:11 PM, Wolfgang Link wrote: > --- > PVE/API2/Storage/Config.pm | 16 > 1 file changed, 16 insertions(+) > > diff --git a/PVE/API2/Storage/Config.pm b/PVE/API2/Storage/Config.pm > index aa8c931..fa8d4de 100755 > --- a/PVE/API2/Storage/Config.pm > +++ b/PVE/API2/Storage/Config.pm > @@ -12,6 +12,7 @@ use HTTP::Status qw(:constants); > use Storable qw(dclone); > use PVE::JSONSchema qw(get_standard_option); > use PVE::RPCEnvironment; > +use Term::ReadLine; > please do not use Term::ReadLine anymore, rather use Wolfgang B.'s nice PTY module, i.e.: use PVE::PTY; > use PVE::RESTHandler; > > @@ -36,6 +37,21 @@ my $api_storage_config = sub { > return $scfg; > }; > > +my $extract_cifs_credentials = sub { > +my ($param) = @_; > + > +my $password = extract_param($param, 'password'); > + > +if (!defined($password)) { > + my $term = new Term::ReadLine ('pvesm'); > + my $attribs = $term->Attribs; > + $attribs->{redisplay_function} = $attribs->{shadow_redisplay}; > + $password = $term->readline('Enter password: '); $password = PVE::PTY::read_password('Enter password: ') if !defined($password); > +} > + > +return "password=$password\n"; > +}; > + > __PACKAGE__->register_method ({ > name => 'index', > path => '', > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel