Esempio n. 1
0
    def ssh(self, command, options=None):
        """
        :type command: str | list[str]
        :type options: list[str] | None
        """
        if not options:
            options = []

        if isinstance(command, list):
            command = ' '.join(cmd_quote(c) for c in command)

        run_command(self.core_ci.args,
                    ['ssh', '-tt', '-q'] + self.ssh_args + options + [
                        '-p',
                        str(self.core_ci.connection.port),
                        '%s@%s' % (self.core_ci.connection.username,
                                   self.core_ci.connection.hostname)
                    ] + self.become + [cmd_quote(command)])
Esempio n. 2
0
    def ssh(self, command, options=None, force_pty=True):
        """
        :type command: str | list[str]
        :type options: list[str] | None
        :type force_pty: bool
        """
        if not options:
            options = []
        if force_pty:
            options.append('-tt')

        if isinstance(command, list):
            command = ' '.join(cmd_quote(c) for c in command)

        run_command(self.core_ci.args,
                    ['ssh', '-q'] + self.ssh_args + options + [
                        '-p', '22',
                        '%s@%s' % (self.core_ci.connection.username,
                                   self.core_ci.connection.hostname)
                    ] + [command])