Esempio n. 1
0
def execute(*args, **kw):
    global imap, pool

    auth = Auth()
    log.debug(_("Listing domains..."), level=5)
    start_time = time.time()
    domains = auth.list_domains()
    end_time = time.time()
    log.debug(
            _("Found %d domains in %d seconds") % (
                    len(domains),
                    (end_time-start_time)
                ),
            level=8
        )

    if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"):
        pool = multiprocessing.Pool(conf.threads, worker_process, (), 1)
    else:
        pool = multiprocessing.Pool(conf.threads, worker_process, ())

    for primary_domain in list(set(domains.values())):
        log.debug(_("Running for domain %s") % (primary_domain), level=8)
        auth = Auth(primary_domain)
        auth.connect(primary_domain)
        start_time = time.time()
        auth.synchronize(mode='_paged_search', callback=queue_add)
        end_time = time.time()

        log.info(_("Synchronizing users for %s took %d seconds")
                % (primary_domain, (end_time-start_time))
            )

    while not pool._taskqueue.empty():
        time.sleep(1)
Esempio n. 2
0
def execute(*args, **kw):
    auth = Auth()
    log.debug(_("Listing domains..."), level=5)
    start_time = time.time()
    domains = auth.list_domains()
    end_time = time.time()
    log.debug(
            _("Found %d domains in %d seconds") % (
                    len(domains),
                    (end_time-start_time)
                ),
            level=8
        )

    all_folders = []

    for primary_domain,secondary_domains in domains:
        log.debug(_("Running for domain %s") % (primary_domain), level=8)
        auth.connect(primary_domain)
        start_time = time.time()
        auth.synchronize()
        end_time = time.time()

        log.info(_("Synchronizing users for %s took %d seconds")
                % (primary_domain, (end_time-start_time))
            )
Esempio n. 3
0
    def synchronize(self, domain):
        sync_interval = conf.get('kolab', 'sync_interval')

        if sync_interval == None or sync_interval == 0:
            sync_interval = 300
        else:
            sync_interval = (int)(sync_interval)

        while True:
            try:
                auth = Auth(domain)
                auth.connect(domain)
                auth.synchronize()
                time.sleep(sync_interval)
            except KeyboardInterrupt:
                break
            except Exception, errmsg:
                log.error(_("Error in process %r, terminating: %r") % (self.name, errmsg))
                import traceback
                traceback.print_exc()
                time.sleep(1)
Esempio n. 4
0
def execute(*args, **kw):
    global imap, pool

    auth = Auth()

    if conf.domain == "all":
        log.debug(_("Listing domains..."), level=5)
        start_time = time.time()
        domains = auth.list_domains()
        end_time = time.time()
        log.debug(_("Found %d domains in %d seconds") %
                  (len(domains), (end_time - start_time)),
                  level=8)
    else:
        domains = {}
        domains[conf.domain] = conf.domain

    if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"):
        pool = multiprocessing.Pool(conf.threads, worker_process, (), 1)
    else:
        pool = multiprocessing.Pool(conf.threads, worker_process, ())

    for primary_domain in list(set(domains.values())):
        log.debug(_("Running for domain %s") % (primary_domain), level=8)
        auth = Auth(primary_domain)
        auth.connect(primary_domain)
        start_time = time.time()
        auth.synchronize(mode='_paged_search', callback=queue_add)
        end_time = time.time()

        log.info(
            _("Synchronizing users for %s took %d seconds") %
            (primary_domain, (end_time - start_time)))

    while not pool._taskqueue.empty():
        time.sleep(1)
Esempio n. 5
0
    def synchronize(self, domain):
        log.debug(_("Synchronizing for domain %s") % (domain), level=8)
        sync_interval = conf.get('kolab', 'sync_interval')

        if sync_interval is None or sync_interval == 0:
            sync_interval = 300
        else:
            sync_interval = (int)(sync_interval)

        while True:
            try:
                auth = Auth(domain)
                auth.connect(domain)
                auth.synchronize()
                time.sleep(sync_interval)
            except KeyboardInterrupt:
                break
            except Exception, errmsg:
                log.error(
                    _("Error in process %r, terminating:\n\t%r") %
                    (self.name, errmsg))
                import traceback
                traceback.print_exc()
                time.sleep(1)
Esempio n. 6
0
def synchronize_once():
    auth = Auth()
    auth.connect()
    auth.synchronize(mode='_paged_search')
Esempio n. 7
0
def synchronize_once():
    auth = Auth()
    auth.connect()
    auth.synchronize(mode='_paged_search')