'Execute a remote command and return stdout/stderr
NOTE: this function blocks until the process finishes
kwargs:
silent - don\'t print the command\'s output to the console
only_printable - filter the command\'s output to allow only printable
characters
ignore_exit_status - don\'t warn about non-zero exit status
log_output - log all remote output to the debug file
detach - detach the remote process so that it continues to run even
after the SSH connection closes (does NOT return output or
check for non-zero exit status if detach=True)
source_profile - if True prefix the command with "source /etc/profile"
raise_on_failure - raise exception.SSHError if command fails
returns List of output lines'

def execute(self, command, silent=True, only_printable=False, ignore_exit_status=False, log_output=True, detach=False, source_profile=True, raise_on_failure=True):

    channel = self.transport.open_session()
    if detach:
        command = ('nohup    %s    &' % command)
        if source_profile:
            command = ('source    /etc/profile    &&    %s' % command)
        channel.exec_command(command)
        channel.close()
        self.__last_status = None
        return
    if source_profile:
        command = ('source    /etc/profile    &&    %s' % command)
    log.debug(('executing    remote    command:    %s' % command))
    channel.exec_command(command)
    output = self._get_output(channel, silent=silent, only_printable=only_printable)
    exit_status = channel.recv_exit_status()
    self.__last_status = exit_status
    out_str = '\n'.join(output)
    if (exit_status != 0):
        msg = "remote    command    '%s'    failed    with    status    %d"
        msg %= (command, exit_status)
        if log_output:
            msg += (':\n%s' % out_str)
        else:
            msg += '    (no    output    log    requested)'
        if (not ignore_exit_status):
            if raise_on_failure:
                raise exception.RemoteCommandFailed(msg, command, exit_status, out_str)
            else:
                log.error(msg)
        else:
            log.debug(('(ignored)    ' + msg))
    elif log_output:
        log.debug(("output    of    '%s':\n%s" % (command, out_str)))
    else:
        log.debug(("output    of    '%s'    has    been    hidden" % command))
    return output
