environment/lib/python2.7/site-packages/IPython/frontend/consoleapp.py
def init_ssh(self):
        """set up ssh tunnels, if needed."""
        if not self.sshserver and not self.sshkey:
            return
        
        if self.sshkey and not self.sshserver:
            # specifying just the key implies that we are connecting directly
            self.sshserver = self.ip
            self.ip = LOCALHOST
        
        # build connection dict for tunnels:
        info = dict(ip=self.ip,
                    shell_port=self.shell_port,
                    iopub_port=self.iopub_port,
                    stdin_port=self.stdin_port,
                    hb_port=self.hb_port
        )
        
        self.log.info("Forwarding connections to %s via %s"%(self.ip, self.sshserver))
        
        # tunnels return a new set of ports, which will be on localhost:
        self.ip = LOCALHOST
        try:
            newports = tunnel_to_kernel(info, self.sshserver, self.sshkey)
        except:
            # even catch KeyboardInterrupt
            self.log.error("Could not setup tunnels", exc_info=True)
            self.exit(1)
        
        self.shell_port, self.iopub_port, self.stdin_port, self.hb_port = newports
        
        cf = self.connection_file
        base,ext = os.path.splitext(cf)
        base = os.path.basename(base)
        self.connection_file = os.path.basename(base)+'-ssh'+ext
        self.log.critical("To connect another client via this tunnel, use:")
        self.log.critical("--existing %s" % self.connection_file)
def init_ssh(self):
        if not self.sshserver and not self.sshkey:
            return
        
        if self.sshkey and not self.sshserver:
            # specifying just the key implies that we are connecting directly
            self.sshserver = self.ip
            self.ip = LOCALHOST
        
        # build connection dict for tunnels:
        info = dict(ip=self.ip,
                    shell_port=self.shell_port,
                    iopub_port=self.iopub_port,
                    stdin_port=self.stdin_port,
                    hb_port=self.hb_port
        )
        
        self.log.info("Forwarding connections to %s via %s"%(self.ip, self.sshserver))
        
        # tunnels return a new set of ports, which will be on localhost:
        self.ip = LOCALHOST
        try:
            newports = tunnel_to_kernel(info, self.sshserver, self.sshkey)
        except:
            # even catch KeyboardInterrupt
            self.log.error("Could not setup tunnels", exc_info=True)
            self.exit(1)
        
        self.shell_port, self.iopub_port, self.stdin_port, self.hb_port = newports
        
        cf = self.connection_file
        base,ext = os.path.splitext(cf)
        base = os.path.basename(base)
        self.connection_file = os.path.basename(base)+'-ssh'+ext
        self.log.critical("To connect another client via this tunnel, use:")
        self.log.critical("--existing %s" % self.connection_file)
def init_ssh ( self ) : if not self . sshserver and not self . sshkey : return if self . sshkey and not self . sshserver : # specifying just the key implies that we are connecting directly self . sshserver = self . ip self . ip = LOCALHOST # build connection dict for tunnels: info = dict ( ip = self . ip , shell_port = self . shell_port , iopub_port = self . iopub_port , stdin_port = self . stdin_port , hb_port = self . hb_port ) self . log . info ( "Forwarding connections to %s via %s" % ( self . ip , self . sshserver ) ) # tunnels return a new set of ports, which will be on localhost: self . ip = LOCALHOST try : newports = tunnel_to_kernel ( info , self . sshserver , self . sshkey ) except : # even catch KeyboardInterrupt self . log . error ( "Could not setup tunnels" , exc_info = True ) self . exit ( 1 ) self . shell_port , self . iopub_port , self . stdin_port , self . hb_port = newports cf = self . connection_file base , ext = os . path . splitext ( cf ) base = os . path . basename ( base ) self . connection_file = os . path . basename ( base ) + '-ssh' + ext self . log . critical ( "To connect another client via this tunnel, use:" ) self . log . critical ( "--existing %s" % self . connection_file )
set up ssh tunnels, if needed.
set up ssh tunnels if needed .