Logo Search packages:      
Sourcecode: belier version File versions

def belier::terminal::Terminal::interprete_ordres (   self,
  num 
)

On interprete un ordre

Definition at line 172 of file terminal.py.

00172                                     :
        """On interprete un ordre"""
        psource = ''
        pdestination = ''
        ligne = self._ordres[num]
        if ligne != linesep:
            if self._a_commande:
                self.traite_commande(ligne)
            elif self._a_optstunnel: 
                # on prepare les options du tunnel
                optstunnel = OptionsTunnel(ligne)
                psource, pdestination = \
                    optstunnel.retourne_options()
                nligne = '-L%s:127.0.0.1:%s' % (psource,
                    pdestination)
                self._pdest = pdestination
                self._script[self._dernierssh] = self._script[
                    self._dernierssh].replace(
                        '-L9999:127.0.0.1:9999', nligne)
                self._a_optstunnel = False
            else:
                if ligne.split()[-1] == '-t':
                    self._a_tunnel = True
                if ligne.split()[-1] == '-ot':
                    self._a_tunnel = True
                    self._a_optstunnel = True
                machine = ligne.split()[0]
                self._machinefinale = ligne.split()[0].split('@')[-1]
                if ':' in self._machinefinale:
                    self._machinefinale, self._port = \
self._machinefinale.split(':')
                    machine = ligne.split()[0].split(':')[0]
                if self._a_tunnel:
                    tunnelopts = '-L9999:127.0.0.1:9999'
                else:
                    tunnelopts = ''

                if self._est_premiereligne:
                    if not self._port:
                        self._script.append('spawn ssh %s %s %s%s' % (
                            SSHOPTS, tunnelopts, machine, linesep))
                    else:
                        self._script.append('spawn ssh -p %s %s %s %s%s' %
                            (self._port, SSHOPTS, tunnelopts, machine, linesep))
                    self._est_premiereligne = False
                else:
                    if not self._port:
                        self._script.append('send -- "ssh %s %s %s\\r"%s' % 
                            (SSHOPTS, tunnelopts, machine, linesep))
                    else:
                        self._script.append(
                            'send -- "ssh -p %s %s %s %s\\r"%s' %
                            (self._port, SSHOPTS, tunnelopts, machine, 
                                linesep))
                if self._a_tunnel:
                    self._dernierssh = len(self._script) - 1
                if ligne.split()[-1] == '-c':
                    self.avec_commande(ligne)
                    self._a_commande = True
                elif ligne.split()[-1] == '-t' or ligne.split()[-1] == '-ot':
                    self.avec_commande(ligne)
                else:
                    self.sans_commande(ligne)

    def avec_commande(self, ligne):


Generated by  Doxygen 1.6.0   Back to index