def check_connection (self):
        """
        Open a telnet connection and try to login. Expected login
        label is "login: ", expected password label is "Password: ".
        """
        self.url_connection = telnetlib.Telnet(timeout=self.aggregate.config["timeout"])
        if log.is_debug(LOG_CHECK):
            self.url_connection.set_debuglevel(1)
        self.url_connection.open(self.host, self.port)
        if self.user:
            self.url_connection.read_until("login: ", 10)
            self.url_connection.write(encode(self.user)+"\n")
            if self.password:
                self.url_connection.read_until("Password: ", 10)
                self.url_connection.write(encode(self.password)+"\n")
                # XXX how to tell if we are logged in??
        self.url_connection.write("exit\n")
def check_connection ( self ) : self . url_connection = telnetlib . Telnet ( timeout = self . aggregate . config [ "timeout" ] ) if log . is_debug ( LOG_CHECK ) : self . url_connection . set_debuglevel ( 1 ) self . url_connection . open ( self . host , self . port ) if self . user : self . url_connection . read_until ( "login: " , 10 ) self . url_connection . write ( encode ( self . user ) + "\n" ) if self . password : self . url_connection . read_until ( "Password: " , 10 ) self . url_connection . write ( encode ( self . password ) + "\n" ) self . url_connection . write ( "exit\n" )
Open a telnet connection and try to login. Expected login
        label is "login: ", expected password label is "Password: ".