Beispiel #1
0
 def reconnect(self,sleep,timeout):
     ui = lockss_daemon.Client(self.domain, self.port, self.username, self.password)
     log.info("Start re-connecting to %s in %s sec" % (self, sleep))
     time.sleep(sleep);
     if not ui.waitForDaemonReady(timeout, sleep):
         log.error( "Failed re-connecting to %s" % self) 
         return False 
     self.ui = ui
     log.info("Success re-connecting to %s" % self)
     return True 
Beispiel #2
0
 def connect(domain, port, username, password, timeout, sleep):
     cache = LockssCache(domain=domain, port = port) 
     if (not username or not password):
         raise RuntimeError, "Must give credentials to connect to %s" % cache
     
     ui = lockss.Client(cache.domain, cache.port, username, password)
     log.debug2("Start connecting to %s:%s as %s" % (domain, port, username))
     if not ui.waitForDaemonReady(timeout, sleep):
         log.error( "Failed connecting to %s" % cache) 
         return None 
     cache = LockssCache.objects.get_or_create(domain=domain, port = port)[0]
     cache.username = username 
     cache.password = password
     cache.ui = ui
     log.info("Success connecting to %s" % cache) 
     return cache