Commit 0dade487 authored by Simon Redman's avatar Simon Redman

Add optional timeout to ssh configurator

parent 79a20659
......@@ -118,15 +118,16 @@ def network_graph_logout(netgraph):
del netgraph._node[node]['session']
def get_output(session, encoding=sys.stdout.encoding):
def get_output(session, encoding=sys.stdout.encoding, timeout=None):
"""
Decode the raw bytes written by the SSH session
:param session: pxssh session to read
:param encoding: encoding to use to interpret the output
:param timeout: time to wait for a prompt to appear
:return: string-form of the read bytes
"""
session.prompt()
session.prompt(timeout=timeout)
return str(session.before.decode(encoding))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment