def __init__(
        self,
        hostname,
        port=DEFAULT_SSH_PORT,
        username=None,
        password=None,
        bastion_host=None,
        key_files=None,
        key_material=None,
        timeout=None,
        passphrase=None,
        handle_stdout_line_func=None,
        handle_stderr_line_func=None,
    ):
        """
        Authentication is always attempted in the following order:

        - The key passed in (if key is provided)
        - Any key we can find through an SSH agent (only if no password and
          key is provided)
        - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (only if no
          password and key is provided)
        - Plain username/password auth, if a password was given (if password is
          provided)
        """
        self.hostname = hostname
        self.port = port
        self.username = username
        self.password = password
        self.key_files = key_files
        self.timeout = timeout
        self.key_material = key_material
        self.bastion_host = bastion_host
        self.passphrase = passphrase
        self.ssh_connect_timeout = cfg.CONF.ssh_runner.ssh_connect_timeout
        self._handle_stdout_line_func = handle_stdout_line_func
        self._handle_stderr_line_func = handle_stderr_line_func

        self.ssh_config_file = os.path.expanduser(
            cfg.CONF.ssh_runner.ssh_config_file_path or "~/.ssh/config"
        )

        if self.timeout and int(self.ssh_connect_timeout) > int(self.timeout) - 2:
            # the connect timeout should not be greater than the action timeout
            self.ssh_connect_timeout = int(self.timeout) - 2

        self.logger = logging.getLogger(__name__)

        self.client = None
        self.sftp_client = None

        self.bastion_client = None
        self.bastion_socket = None
        self.socket = None

        Authentication is always attempted in the following order:

        - The key passed in (if key is provided)
        - Any key we can find through an SSH agent (only if no password and
          key is provided)
        - Any "id_rsa" or "id_dsa" key discoverable in ~/.ssh/ (only if no
          password and key is provided)
        - Plain username/password auth, if a password was given (if password is
          provided)
        
st2common/st2common/runners/paramiko_ssh.py