'Run command over shell for older firmware versions.
Invokes shell and issue the command and return the output.
This is primarily used for issuing read commands when we are not sure
if the firmware supports exec_command.'

def _execute_shell_cmd(self, cmd):

    utils.check_ssh_injection(cmd)
    command = '    '.join(cmd)
    (stdout, stderr) = (None, None)
    if (not self.sshpool):
        self.sshpool = ssh_utils.SSHPool(self.switch_ip, self.switch_port, None, self.switch_user, self.switch_pwd, self.switch_key, min_size=1, max_size=5)
    with self.sshpool.item() as ssh:
        LOG.debug('Running    cmd    (SSH):    %s', command)
        channel = ssh.invoke_shell()
        stdin_stream = channel.makefile('wb')
        stdout_stream = channel.makefile('rb')
        stderr_stream = channel.makefile('rb')
        stdin_stream.write(('%s\nexit\n' % command))
        stdin_stream.flush()
        stdout = stdout_stream.readlines()
        stderr = stderr_stream.readlines()
        stdin_stream.close()
        stdout_stream.close()
        stderr_stream.close()
        exit_status = channel.recv_exit_status()
        if (exit_status != (-1)):
            LOG.debug('Result    was    %s', exit_status)
            if (exit_status != 0):
                LOG.debug('command    %s    failed', command)
                raise processutils.ProcessExecutionError(exit_code=exit_status, stdout=stdout, stderr=stderr, cmd=command)
        try:
            channel.close()
        except Exception:
            LOG.exception('Error    closing    channel.')
        LOG.debug('_execute_cmd:    stdout    to    return:    %s', stdout)
        LOG.debug('_execute_cmd:    stderr    to    return:    %s', stderr)
    return (stdout, stderr)
