topology_connect.shell¶
topology_connect shell management module.
Classes¶
SshMixin: SSH connection mixin for the Topology shell API.TelnetMixin: Telnet connection mixin for the Topology shell API.SshShell: Simple class mixing the pexcept based shell with the SSH mixin.TelnetShell: Simple class mixing the pexcept based shell with the Telnet mixin.SshBashShell: Simple class mixing the Bash specialized pexcept based shell with the SSHTelnetBashShell: Simple class mixing the Bash specialized pexcept based shell with the
-
class
topology_connect.shell.SshMixin(*args, **kwargs)¶ SSH connection mixin for the Topology shell API.
This class implements a
_get_connect_command()method that allows to interact with a shell through an SSH session, and extends the constructor to request for SSH related connection parameters.The default options will assume that you will be connecting using a SSH key (and you seriously SHOULD). If, for some reason, you MUST use a password to connect to the shell in question (and DON’T unless absolutely required! Like, really, really, DO NOT!) you must set the
identity_filetoNoneand set the options to at least haveBatchMode=no. Also, as expected by the Topology shell low level API you must pass thepassword(andpassword_matchif required) to the constructor.Note: The constructor of this class should look as follow:
# Using PEP 3102 -- Keyword-Only Arguments def __init__( self, *args, user=None, hostname='127.0.0.1', port=22, # noqa options=('BatchMode=yes', ), identity_file='id_rsa', **kwargs):Sadly, this is Python 3 only. Python 2.7 didn’t backported this feature. So, this is the legacy way to achieve the same goal. Awful, I know :/
Parameters: - user (str) – User to connect with. If
None, the user running the process will be used. - hostname (str) – Hostname or IP to connect to.
- port (int) – SSH port to connect to.
- options (tuple) – SSH options to use.
- identity_file (str) – Absolute or relative (in relation to
~/.ssh/) path to the private key identity file. IfNoneis provided, key based authentication will not be used.
Inheritance
- user (str) – User to connect with. If
-
class
topology_connect.shell.TelnetMixin(*args, **kwargs)¶ Telnet connection mixin for the Topology shell API.
Note: The constructor of this class should look as follow:
# Using PEP 3102 -- Keyword-Only Arguments def __init__( self, *args, hostname='127.0.0.1', port=23, **kwargs):Sadly, this is Python 3 only. Python 2.7 didn’t backported this feature. So, this is the legacy way to achieve the same goal. Awful, I know :/
Parameters: Inheritance
-
class
topology_connect.shell.SshShell(*args, **kwargs)¶ Simple class mixing the pexcept based shell with the SSH mixin.
Inheritance
-
class
topology_connect.shell.TelnetShell(*args, **kwargs)¶ Simple class mixing the pexcept based shell with the Telnet mixin.
Inheritance
-
class
topology_connect.shell.SshBashShell(*args, **kwargs)¶ Simple class mixing the Bash specialized pexcept based shell with the SSH mixin.
Inheritance
-
class
topology_connect.shell.TelnetBashShell(*args, **kwargs)¶ Simple class mixing the Bash specialized pexcept based shell with the Telnet mixin.
Inheritance