[CalendarServer-changes] [9737] CalendarServer/trunk/contrib/migration
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 22 18:13:46 PDT 2012
Revision: 9737
http://trac.macosforge.org/projects/calendarserver/changeset/9737
Author: sagen at apple.com
Date: 2012-08-22 18:13:43 -0700 (Wed, 22 Aug 2012)
Log Message:
-----------
Detect whether to set EnableAPNS in the migration extra by examining the previous XMPP+APNS settings
Modified Paths:
--------------
CalendarServer/trunk/contrib/migration/calendarmigrator.py
CalendarServer/trunk/contrib/migration/test/test_migrator.py
Modified: CalendarServer/trunk/contrib/migration/calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/calendarmigrator.py 2012-08-21 20:57:11 UTC (rev 9736)
+++ CalendarServer/trunk/contrib/migration/calendarmigrator.py 2012-08-23 01:13:43 UTC (rev 9737)
@@ -417,11 +417,27 @@
# Disable XMPPNotifier now that we're directly talking to APNS
try:
- if caldav["Notifications"]["Services"]["XMPPNotifier"]["Enabled"]:
- caldav["Notifications"]["Services"]["XMPPNotifier"]["Enabled"] = False
+ XMPPNotifier = caldav["Notifications"]["Services"]["XMPPNotifier"]
+ if XMPPNotifier["Enabled"]:
+ XMPPNotifier["Enabled"] = False
except KeyError:
pass
+ # If XMPP was also previously being routed to APNS, enable APNS
+ EnableAPNS = False
+ try:
+ if caldav["Notifications"]["Services"]["XMPPNotifier"]["CalDAV"]["APSBundleID"]:
+ EnableAPNS = True
+ except KeyError:
+ pass
+ try:
+ if caldav["Notifications"]["Services"]["XMPPNotifier"]["CardDAV"]["APSBundleID"]:
+ EnableAPNS = True
+ except KeyError:
+ pass
+ if EnableAPNS:
+ adminChanges.append(["EnableAPNS", "yes"])
+
# Merge ports
if not caldav.get("HTTPPort", 0):
caldav["HTTPPort"] = 8008
Modified: CalendarServer/trunk/contrib/migration/test/test_migrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/test/test_migrator.py 2012-08-21 20:57:11 UTC (rev 9736)
+++ CalendarServer/trunk/contrib/migration/test/test_migrator.py 2012-08-23 01:13:43 UTC (rev 9737)
@@ -432,11 +432,18 @@
# Ensure XMPPNotifier is disabled
+ # Both CalDAV and CardDAV push enabled:
oldCalDAV = {
"Notifications": {
"Services" : {
"XMPPNotifier" : {
"Enabled" : True,
+ "CalDAV" : {
+ "APSBundleID" : "com.apple.calendar.XServer",
+ },
+ "CardDAV" : {
+ "APSBundleID" : "com.apple.contact.XServer",
+ },
},
},
},
@@ -447,6 +454,12 @@
"Services" : {
"XMPPNotifier" : {
"Enabled" : False,
+ "CalDAV" : {
+ "APSBundleID" : "com.apple.calendar.XServer",
+ },
+ "CardDAV" : {
+ "APSBundleID" : "com.apple.contact.XServer",
+ },
},
},
},
@@ -463,10 +476,126 @@
}
newCombined = { }
adminChanges = mergePlist(oldCalDAV, oldCardDAV, newCombined)
+ self.assertEquals(adminChanges, [["EnableAPNS", "yes"]])
+ self.assertEquals(newCombined, expected)
+
+ # Only with CalDAV push enabled:
+ oldCalDAV = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : True,
+ "CalDAV" : {
+ "APSBundleID" : "com.apple.calendar.XServer",
+ },
+ },
+ },
+ },
+ }
+ oldCardDAV = { }
+ expected = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : False,
+ "CalDAV" : {
+ "APSBundleID" : "com.apple.calendar.XServer",
+ },
+ },
+ },
+ },
+ "BindHTTPPorts": [8008, 8800],
+ "BindSSLPorts": [8443, 8843],
+ "DSN" : "/Library/Server/PostgreSQL For Server Services/Socket:caldav:caldav:::",
+ "EnableSSL" : False,
+ "HTTPPort": 8008,
+ "RedirectHTTPToHTTPS": False,
+ "SSLAuthorityChain": "",
+ "SSLCertificate": "",
+ "SSLPort": 8443,
+ "SSLPrivateKey": "",
+ }
+ newCombined = { }
+ adminChanges = mergePlist(oldCalDAV, oldCardDAV, newCombined)
+ self.assertEquals(adminChanges, [["EnableAPNS", "yes"]])
+ self.assertEquals(newCombined, expected)
+
+ # Only with CardDAV push enabled:
+ oldCalDAV = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : True,
+ "CardDAV" : {
+ "APSBundleID" : "com.apple.contact.XServer",
+ },
+ },
+ },
+ },
+ }
+ oldCardDAV = { }
+ expected = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : False,
+ "CardDAV" : {
+ "APSBundleID" : "com.apple.contact.XServer",
+ },
+ },
+ },
+ },
+ "BindHTTPPorts": [8008, 8800],
+ "BindSSLPorts": [8443, 8843],
+ "DSN" : "/Library/Server/PostgreSQL For Server Services/Socket:caldav:caldav:::",
+ "EnableSSL" : False,
+ "HTTPPort": 8008,
+ "RedirectHTTPToHTTPS": False,
+ "SSLAuthorityChain": "",
+ "SSLCertificate": "",
+ "SSLPort": 8443,
+ "SSLPrivateKey": "",
+ }
+ newCombined = { }
+ adminChanges = mergePlist(oldCalDAV, oldCardDAV, newCombined)
+ self.assertEquals(adminChanges, [["EnableAPNS", "yes"]])
+ self.assertEquals(newCombined, expected)
+
+ # APNS push was not previously enabled:
+ oldCalDAV = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : True,
+ },
+ },
+ },
+ }
+ oldCardDAV = { }
+ expected = {
+ "Notifications": {
+ "Services" : {
+ "XMPPNotifier" : {
+ "Enabled" : False,
+ },
+ },
+ },
+ "BindHTTPPorts": [8008, 8800],
+ "BindSSLPorts": [8443, 8843],
+ "DSN" : "/Library/Server/PostgreSQL For Server Services/Socket:caldav:caldav:::",
+ "EnableSSL" : False,
+ "HTTPPort": 8008,
+ "RedirectHTTPToHTTPS": False,
+ "SSLAuthorityChain": "",
+ "SSLCertificate": "",
+ "SSLPort": 8443,
+ "SSLPrivateKey": "",
+ }
+ newCombined = { }
+ adminChanges = mergePlist(oldCalDAV, oldCardDAV, newCombined)
self.assertEquals(adminChanges, [])
self.assertEquals(newCombined, expected)
-
def test_examinePreviousSystem(self):
"""
Set up a virtual system in various configurations, then ensure the
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120822/e8992316/attachment.html>
More information about the calendarserver-changes
mailing list