How to use the labgrid.util.ssh.SSHConnection function in labgrid

To help you get started, we’ve selected a few labgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github labgrid-project / labgrid / tests / test_util.py View on Github external
def test_sshconnection_inactive_raise():
    from labgrid.util.ssh import SSHConnection
    con = SSHConnection("localhost")
    with pytest.raises(ExecutionError):
        con.run_check("echo Hallo")
github labgrid-project / labgrid / tests / test_util.py View on Github external
def connection_localhost():
    con = SSHConnection("localhost")
    con.connect()
    yield con
    con.disconnect()
github labgrid-project / labgrid / tests / test_util.py View on Github external
def test_sshmanager_invalid_host_raise():
    con = SSHConnection("nosuchhost.notavailable")
    with pytest.raises(ExecutionError):
        con.connect()
github labgrid-project / labgrid / tests / test_util.py View on Github external
def test_sshmanager_add_duplicate(sshmanager_fix):
    host = 'localhost'
    con = SSHConnection(host)
    sshmanager_fix.add_connection(con)
    con_there = sshmanager_fix._connections[host]
    sshmanager_fix.add_connection(con)
    con_now = sshmanager_fix._connections[host]

    assert con_now == con_there
github labgrid-project / labgrid / tests / test_util.py View on Github external
def test_sshconnection_get():
    from labgrid.util.ssh import SSHConnection
    SSHConnection("localhost")
github labgrid-project / labgrid / labgrid / util / ssh.py View on Github external
def get(self, host: str):
        """Retrieve or create a new connection to a given host

        Arguments:
            host (str): host to retrieve the connection for

        Returns:
            :obj:`SSHConnection`: the SSHConnection for the host"""
        instance = self._connections.get(host)
        if instance is None:
            # pylint: disable=unsupported-assignment-operation
            self.logger.debug("Creating SSHConnection for %s", host)
            instance = SSHConnection(host)
            instance.connect()
            self._connections[host] = instance
        return instance
github labgrid-project / labgrid / labgrid / util / ssh.py View on Github external
def _get_ssh_args(self):
        args = SSHConnection._get_ssh_base_args()
        args += self._get_ssh_control_args()
        return args