On Fri, 2024-04-12 at 16:37 -0700, Jakub Kicinski wrote:
> +class Endpoint:
> +    def __init__(self, name):
> +        self.name = name
> +        self._tmpdir = None
> +
> +    def __del__(self):
> +        if self._tmpdir:
> +            self.cmd("rm -rf " + self._tmpdir)
> +            self._tmpdir = None
> +
> +    def cmd(self, comm, *args):
> +        c = cmd("ssh " + self.name + " " + shlex.quote(comm), *args)
> +        return c.stdout, c.stderr, c.ret

If I read correctly the above will do a full ssh handshake for each
command. If the test script/setup is complex, I think/fear the overhead
could become a bit cumbersome.

Would using something alike Fabric to create a single connection at
endpoint instantiation time and re-using it for all the command be too
much? 


Thanks,

Paolo


Reply via email to