Exemple #1
0
 def start_checkpoint_thread(self):
     """prepare and start checkpoint service"""
     if self.checkpoint_thread or not (
             getattr(gconf, 'state_socket_unencoded', None)
             and getattr(gconf, 'socketdir', None)):
         return
     chan = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     state_socket = os.path.join(
         gconf.socketdir,
         md5hex(gconf.state_socket_unencoded) + ".socket")
     try:
         os.unlink(state_socket)
     except:
         if sys.exc_info()[0] == OSError:
             pass
     chan.bind(state_socket)
     chan.listen(1)
     checkpt_tgt = None
     if gconf.checkpoint:
         checkpt_tgt = self._checkpt_param(gconf.checkpoint, 'target')
         if not checkpt_tgt:
             checkpt_tgt = self.xtime('.')
             if isinstance(checkpt_tgt, int):
                 raise GsyncdError(
                     "master root directory is unaccessible (%s)",
                     os.strerror(checkpt_tgt))
             self._set_checkpt_param(gconf.checkpoint, 'target',
                                     checkpt_tgt)
         logging.debug("checkpoint target %s has been determined for checkpoint %s" % \
                       (repr(checkpt_tgt), gconf.checkpoint))
     t = Thread(target=self.checkpt_service,
                args=(chan, gconf.checkpoint, checkpt_tgt))
     t.start()
     self.checkpoint_thread = t
Exemple #2
0
 def start_checkpoint_thread(self):
     """prepare and start checkpoint service"""
     if self.checkpoint_thread or not (
         getattr(gconf, "state_socket_unencoded", None) and getattr(gconf, "socketdir", None)
     ):
         return
     chan = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     state_socket = os.path.join(gconf.socketdir, md5hex(gconf.state_socket_unencoded) + ".socket")
     try:
         os.unlink(state_socket)
     except:
         if sys.exc_info()[0] == OSError:
             pass
     chan.bind(state_socket)
     chan.listen(1)
     checkpt_tgt = None
     if gconf.checkpoint:
         checkpt_tgt = self._checkpt_param(gconf.checkpoint, "target")
         if not checkpt_tgt:
             checkpt_tgt = self.xtime(".")
             if isinstance(checkpt_tgt, int):
                 raise GsyncdError("master root directory is unaccessible (%s)", os.strerror(checkpt_tgt))
             self._set_checkpt_param(gconf.checkpoint, "target", checkpt_tgt)
         logging.debug(
             "checkpoint target %s has been determined for checkpoint %s" % (repr(checkpt_tgt), gconf.checkpoint)
         )
     t = Thread(target=self.checkpt_service, args=(chan, gconf.checkpoint, checkpt_tgt))
     t.start()
     self.checkpoint_thread = t
Exemple #3
0
 def setup_working_dir(self):
     workdir = os.path.join(gconf.working_dir, md5hex(gconf.local_path))
     logfile = os.path.join(workdir, 'changes.log')
     logging.debug('changelog working dir %s (log: %s)' %
                   (workdir, logfile))
     return (workdir, logfile)
Exemple #4
0
 def setup_working_dir(self):
     workdir = os.path.join(gconf.working_dir, md5hex(gconf.local_path))
     logfile = os.path.join(workdir, "changes.log")
     logging.debug("changelog working dir %s (log: %s)" % (workdir, logfile))
     return (workdir, logfile)