connections¶
cec¶
telnet¶
-
class
otto.connections.telnet.Telnet(username, hostname, password, prompt, port=None)[source]¶ Connect via telnet. This spawns a process running the installed telnet client to interact with an appliance.
ssh¶
-
class
otto.connections.ssh.Client(host, user, password, port=22, compress=True)[source]¶ Connect to a host using paramiko, a Python interface to the SSH2 protocol. Transport compression is enabled by default now.
Client.environmentals is a dictionary of environment variables to be set. They can be manipulated on the fly with care or using the env context manager, otto.lib.contextmanager.env().
-
connect(timeout=10, key_file=None)[source]¶ Currently this method will return False if we can’t connect. If the script ignores this return and proceeds the traceback might not be obvious as to where the problem was.
-
ls(path=None, expectation=True)[source]¶ return a list of files in path. If path is not specified cwd will be used. If path does not exist an exception will be raised unless expectation is False. Works in conjunction with the cd context manager.
-
open(fname, mode='r', bufsize=-1, expectation=True)[source]¶ return a file-like object of fname on the remote
-
reconnect(after=10, timeout=10, key_file=None, conn_attempts=10)[source]¶ This method will attempt to reconnect with the host, maybe after a reboot action.
The method will have a limit of 10 attempts to connect by default, for a total of 300 seconds before it gives up with the reconnection.
-
-
class
otto.connections.ssh.TunnelSocketCreator(host, user, port=22, key_filename=None, compress=True)[source]¶ a class for opening sockets remotely with ssh
-
class
otto.connections.ssh.parallelCmd(user, hostname, password, command, port=22)[source]¶ a non-blocking remote command running object
c = Cmd(init, params) c.run() # do other things c.wait() # or use an 'if not c.done:' control struct c.result.status c.result.message
When the remote job has completed it will set:
.done to True .message with the dict version of the fio output .status with the exit code as a boolean
and try to store the json data as a dict in .dict .
-
done¶ Returns: whether or not the job is complete Return type: bool
-
result¶ Return the result as a NamedTuple this means that result can be sliced or referenced by name:
status or 0: exitcode as int stdout or 1: stdout as str stderr or 2: stderr as strso upon completion the following:
cmd.result[0] cmd.statusare equivilent. If the process is not complete this will block.
-