[CalendarServer-changes] [13945] CalendarServer/trunk/calendarserver/tools/principals.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 8 10:05:32 PDT 2014
Revision: 13945
http://trac.calendarserver.org//changeset/13945
Author: sagen at apple.com
Date: 2014-09-08 10:05:32 -0700 (Mon, 08 Sep 2014)
Log Message:
-----------
csmp can now schedule a group cache refresh using --refresh-groups
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/principals.py
Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py 2014-09-08 16:31:42 UTC (rev 13944)
+++ CalendarServer/trunk/calendarserver/tools/principals.py 2014-09-08 17:05:32 UTC (rev 13945)
@@ -36,6 +36,7 @@
addDelegate, removeDelegate, RecordType as DelegateRecordType
)
from txdav.who.idirectory import AutoScheduleMode
+from txdav.who.groups import GroupCacherPollingWork
allowedAutoScheduleModes = {
@@ -94,6 +95,7 @@
print(" --get-street-address: get the street address string for an address")
print(" --set-address=guid: associate principal with an address (by guid)")
print(" --get-address: get the associated address's guid")
+ print(" --refresh-groups: schedule a group membership refresh")
if e:
sys.exit(64)
@@ -150,6 +152,7 @@
"get-address",
"set-street-address=",
"get-street-address",
+ "refresh-groups",
"verbose",
],
)
@@ -165,6 +168,7 @@
listPrincipals = None
searchPrincipals = None
printGroupInfo = False
+ scheduleGroupRefresh = False
principalActions = []
verbose = False
@@ -194,6 +198,9 @@
elif opt in ("", "--print-group-info"):
printGroupInfo = True
+ elif opt in ("", "--refresh-groups"):
+ scheduleGroupRefresh = True
+
elif opt in ("", "--list-principals"):
listPrincipals = arg
@@ -279,6 +286,10 @@
function = printGroupCacherInfo
params = ()
+ elif scheduleGroupRefresh:
+ function = scheduleGroupRefreshJob
+ params = ()
+
elif addType:
try:
@@ -836,6 +847,18 @@
+ at inlineCallbacks
+def scheduleGroupRefreshJob(service, store):
+ """
+ Schedule GroupCacherPollingWork
+ """
+ txn = store.newTransaction()
+ print("Scheduling a group refresh")
+ yield GroupCacherPollingWork.reschedule(txn, 0, force=True)
+ yield txn.commit()
+
+
+
def abort(msg, status=1):
sys.stdout.write("%s\n" % (msg,))
try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140908/992bb0ff/attachment.html>
More information about the calendarserver-changes
mailing list