示例#1
0
    def __init__(self, runner, host, port, user, password, private_key_file,
                 *args, **kwargs):

        self.runner = runner
        self.host = host
        self.context = None
        self.conn = None
        self.user = user
        self.key = utils.key_for_hostname(host)
        self.port = port[0]
        self.fbport = port[1]
        self.is_connected = False

        if self.runner.original_transport == "paramiko":
            self.ssh = ParamikoConnection(runner=self.runner,
                                          host=self.host,
                                          port=self.port,
                                          user=self.user,
                                          password=password,
                                          private_key_file=private_key_file)
        else:
            self.ssh = SSHConnection(runner=self.runner,
                                     host=self.host,
                                     port=self.port,
                                     user=self.user,
                                     password=password,
                                     private_key_file=private_key_file)

        # attempt to work around shared-memory funness
        if getattr(self.runner, 'aes_keys', None):
            utils.AES_KEYS = self.runner.aes_keys
示例#2
0
    def __init__(self, runner, host, port, user, password, private_key_file, *args, **kwargs):

        self.runner = runner
        self.host = host
        self.context = None
        self.conn = None
        self.user = user
        self.key = utils.key_for_hostname(host)
        self.port = port[0]
        self.accport = port[1]
        self.is_connected = False
        self.has_pipelining = False

        if not self.port:
            self.port = constants.DEFAULT_REMOTE_PORT
        elif not isinstance(self.port, int):
            self.port = int(self.port)

        if not self.accport:
            self.accport = constants.ACCELERATE_PORT
        elif not isinstance(self.accport, int):
            self.accport = int(self.accport)

        if self.runner.original_transport == "paramiko":
            self.ssh = ParamikoConnection(
                runner=self.runner,
                host=self.host,
                port=self.port,
                user=self.user,
                password=password,
                private_key_file=private_key_file
            )
        else:
            self.ssh = SSHConnection(
                runner=self.runner,
                host=self.host,
                port=self.port,
                user=self.user,
                password=password,
                private_key_file=private_key_file
            )

        if not getattr(self.ssh, 'shell', None):
            self.ssh.shell = utils.plugins.shell_loader.get('sh')

        # attempt to work around shared-memory funness
        if getattr(self.runner, 'aes_keys', None):
            utils.AES_KEYS = self.runner.aes_keys