On 9/3/19 5:08 PM, 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.
Why not use a dictionary? Keys would be explicit. > 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') > > 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. >