Esempio n. 1
0
def get_connection(hostname, logger, threads=5):
    """
    A very simple helper, meant to return a connection
    that will know about the need to use sudo.
    """
    try:
        return Connection(
            hostname,
            logger=logger,
            sudo=needs_sudo(),
            threads=threads,
        )

    except Exception as error:
        msg = "connecting to host: %s " % hostname
        errors = "resulted in errors: %s %s" % (error.__class__.__name__, error)
        raise RuntimeError(msg + errors)
Esempio n. 2
0
def get_connection(hostname, logger, threads=5):
    """
    A very simple helper, meant to return a connection
    that will know about the need to use sudo.
    """
    try:
        return Connection(
            hostname,
            logger=logger,
            sudo=needs_sudo(),
            threads=threads,
        )

    except Exception as error:
        msg = "connecting to host: %s " % hostname
        errors = "resulted in errors: %s %s" % (error.__class__.__name__,
                                                error)
        raise RuntimeError(msg + errors)