[CalendarServer-changes] [13627] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 10 12:33:46 PDT 2014


Revision: 13627
          http://trac.calendarserver.org//changeset/13627
Author:   sagen at apple.com
Date:     2014-06-10 12:33:46 -0700 (Tue, 10 Jun 2014)
Log Message:
-----------
Enabling automatic purge of data for principals no longer in the directory

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/calendarserver/tools/cmdline.py
    CalendarServer/trunk/conf/caldavd-apple.plist

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2014-06-10 19:22:05 UTC (rev 13626)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2014-06-10 19:33:46 UTC (rev 13627)
@@ -72,6 +72,7 @@
 from twext.enterprise.jobqueue import WorkerFactory as QueueWorkerFactory
 from twext.application.service import ReExecService
 from txdav.who.groups import GroupCacherPollingWork
+from calendarserver.tools.purge import PrincipalPurgePollingWork
 
 from txweb2.channel.http import (
     LimitingHTTPFactory, SSLRedirectRequest, HTTPChannel
@@ -568,7 +569,7 @@
     """
     log = Logger()
 
-    def __init__(self, store, doImip, doGroupCaching):
+    def __init__(self, store, doImip, doGroupCaching, doPrincipalPurging):
         """
         @param store: the Store to use for enqueuing work
         @param doImip: whether to schedule imip polling
@@ -579,6 +580,7 @@
         self.store = store
         self.doImip = doImip
         self.doGroupCaching = doGroupCaching
+        self.doPrincipalPurging = doPrincipalPurging
 
 
     @inlineCallbacks
@@ -597,6 +599,11 @@
                 self.store,
                 int(config.LogID) if config.LogID else 5
             )
+        if self.doPrincipalPurging:
+            yield PrincipalPurgePollingWork.initialSchedule(
+                self.store,
+                int(config.LogID) if config.LogID else 5
+            )
         yield FindMinValidRevisionWork.initialSchedule(
             self.store,
             int(config.LogID) if config.LogID else 5
@@ -606,15 +613,8 @@
             int(config.LogID) if config.LogID else 5
         )
 
-        # FIXME: uncomment this when purge is working
-        # from calendarserver.tools.purge import scheduleNextPrincipalPurgeUpdate
-        # yield PrincipalPurgePollingWork.initialSchedule(
-        #     self.store,
-        #     int(config.LogID) if config.LogID else 5
-        # )
 
 
-
 class PreProcessingService(Service):
     """
     A Service responsible for running any work that needs to be finished prior
@@ -1100,7 +1100,8 @@
         WorkSchedulingService(
             store,
             config.Scheduling.iMIP.Enabled,
-            (config.GroupCaching.Enabled and config.GroupCaching.EnableUpdater)
+            (config.GroupCaching.Enabled and config.GroupCaching.EnableUpdater),
+            config.AutomaticPurging.Enabled
         ).setServiceParent(service)
 
         # For calendarserver.tap.test

Modified: CalendarServer/trunk/calendarserver/tools/cmdline.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/cmdline.py	2014-06-10 19:22:05 UTC (rev 13626)
+++ CalendarServer/trunk/calendarserver/tools/cmdline.py	2014-06-10 19:33:46 UTC (rev 13627)
@@ -18,8 +18,6 @@
 Shared main-point between utilities.
 """
 
-from twistedcaldav.stdconfig import config
-from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
 from calendarserver.tap.util import checkDirectories
 from calendarserver.tools.util import loadConfig, autoDisableMemcached
 
@@ -37,7 +35,10 @@
 # TODO: direct unit tests for these functions.
 
 
-def utilityMain(configFileName, serviceClass, reactor=None, serviceMaker=CalDAVServiceMaker, patchConfig=None, onShutdown=None, verbose=False):
+def utilityMain(
+    configFileName, serviceClass, reactor=None, serviceMaker=None,
+    patchConfig=None, onShutdown=None, verbose=False
+):
     """
     Shared main-point for utilities.
 
@@ -69,6 +70,10 @@
         will be imported and used.
     """
 
+    from calendarserver.tap.caldav import CalDAVServiceMaker, CalDAVOptions
+    if serviceMaker is None:
+        serviceMaker = CalDAVServiceMaker
+
     # We want to validate that the actual service is always an instance of WorkerService, so wrap the
     # service maker callback inside a function that does that check
     def _makeValidService(store):

Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist	2014-06-10 19:22:05 UTC (rev 13626)
+++ CalendarServer/trunk/conf/caldavd-apple.plist	2014-06-10 19:33:46 UTC (rev 13627)
@@ -528,19 +528,29 @@
     <!-- Directory searching -->
     <key>DirectoryAddressBook</key>
     <dict>
-	<key>Enabled</key>
-	<true/>
-        <key>params</key>
-        <dict>
-            <key>queryUserRecords</key>
-            <false/>
-            <key>queryPeopleRecords</key>
-            <false/>
-        </dict>
+	    <key>Enabled</key>
+	    <true/>
+      <key>params</key>
+      <dict>
+        <key>queryUserRecords</key>
+        <false/>
+        <key>queryPeopleRecords</key>
+        <false/>
+      </dict>
     </dict>
+
     <key>EnableSearchAddressBook</key>
     <false/>
 
+
+    <!-- Automatic purging of data for principals no longer in the directory
+      -->
+    <key>AutomaticPurging</key>
+    <dict>
+      <key>Enabled</key>
+      <true/>
+    </dict>
+
     <key>Includes</key>
     <array>
         <string>/Library/Preferences/com.apple.servermgr_calendar.plist</string>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140610/01c5f058/attachment-0001.html>


More information about the calendarserver-changes mailing list