On Tue, Sep 03, 2019 at 11:08:24AM -0400, Cleber Rosa wrote: > On Thu, Aug 29, 2019 at 11:46:15AM +0200, Philippe Mathieu-Daudé wrote: > > > > class avocado.utils.ssh.Session(address, credentials) > > > > Parameters: > > > > credentials (tuple) > > username and path to a key for authentication purposes > > > > The current test uses username + password. > > Can we use this credentials with the Avocado module? > > (The image used is prebuilt). > > > > I'm working on adding password based authentication. To keep the API > the same, I'm thinking of checking if the second credential item is an > existing file, if it is, assume one containing a key. If not, assume > it's a password. > > This should make the use simple in the case of keys: > > with Session(('hostname', port), > ('username', '/path/to/key')) as session: > session.cmd('cmd') > > And passwords: > > with Session(('hostname', port), > ('username', 'p@ssw0rD')) as session: > session.cmd('cmd')
This would stop working as soon as a file named 'p@ssw0rD' gets created. Can the API be more explicit somehow? Is there anything that prevents us from using keyword arguments? e.g.: Session(..., username='root', password='p@ssw0rD') > > It's being tracked here: > > https://trello.com/c/uetpIgML/1517-avocadoutilssh-implement-password-based-auth > > I'll try to have it in Avocado's 72.0 release due next week. > > Let me know how that sounds, and thanks for the feedback. > - Cleber. -- Eduardo