On Wednesday 11 November 2015 09:36, Pablo Lucena wrote:
> I am running into a bit of an issue with keeping a context manager open
> through function calls. Here is what I mean:
[...]
> In order to keep the SSH session open and not have to re-establish it
> across function calls, I would like to d
On Wed, Nov 11, 2015 at 9:36 AM, Pablo Lucena wrote:
> And calling it as such:
>
> def do_more_stuff(device):
> gen = do_stuff(device, return_handle=True)
> data, conn = next(gen)
> output = conn.send_command("show users")
> #process output...
> return processed_output
The fir
Pablo Lucena writes:
> In order to keep the SSH session open and not have to re-establish it
> across function calls, I would like to do add an argument to
> "do_stuff" which can optionally return the SSH session along with the
> data returned from the SSH session, as follows:
>
> def do_stuff(de
I am running into a bit of an issue with keeping a context manager open
through function calls. Here is what I mean:
There is a context-manager defined in a module which I use to open SSH
connections to network devices. The "setup" code handles opening the SSH
sessions and handling any issues, and