Dne 03. 09. 19 v 17:47 Cleber Rosa napsal(a): > On Tue, Sep 03, 2019 at 05:22:48PM +0200, Philippe Mathieu-Daudé wrote: >> 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. >> > > Now it's clear that a dict would've been the best option from the > beginning, but I was wrongly optimistic, and biased by the > "avocado.utils.vmimage" + "avocado.utils.cloudinit" combination, that > we'd only have to deal with key based auth. > > So the question now is really how to evolve the API, either breaking > the current version or not. At this time, I'd try to keep the API > unchanged, given that it still feels logical that the tuple is about > credentials, just that the second item can be either a path to a key > or password. > > Thoughts? > - Cleber. >
How old is this feature? I guess it's not yet widely used so it's probably better to change it now than suffer the consequences when hundreds of people rely on it... Regards, Lukáš PS: My favorited solution would be: with Session(addr=(hostname, port), username="user", key="/path/to/key", password="pass"): ... >>> 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. >>>
signature.asc
Description: OpenPGP digital signature