Tags:

    How to fix 10.5-to-10.6 CalDAV migration

    When upgrading from a Mac OS X 10.5 Leopard Server to 10.6 Snow Leopard Server, the system provides several Python scripts for migrating the data from the former to the latter. Included is a script for migrating group calendar data called 95-wiki_calendar_migrator.py. The problem is that this script is not looking in the right place for the old data to convert to the new structure. So, what we must do is find the original data, move it to a better spot, and point the script to it.


    1. Locate the original data that failed to be moved

    Note that permissions here are set for access only by the _calendar user/group, so you may want to make it easier on yourself and set:

    sudo -s

    so that you don't have to keep typing sudo just to do simple tasks like ls -al. Anyway, the data should be buried under the following path:

    /Library/CalendarServer/Documents/calendars/__uids__/

    You'll likely see several folders here w/ 2-letter designations, and inside those are add'l 2-letter folders. At the third level from here is a group-specific folder w/ full UID name, such as:

    .../__uids__/0A/1E/0A1E2D8B-06CE-4E1A-931A-5A0E2F6E4D61

    Look inside each of these that you find. When you get one that has more UID-named folders inside, as well as "dropbox,""inbox," and "outbox," you've found a group calendar (or at least one that has or has had data in it).


    2. Move the folders you need to where the script will find it

    Move each of these folders/UIDs that you need to migrate up to the "__uids__" level:

    sudo mv /Library/CalendarServer/Documents/calendars/__uids__/0A/1E/0A1E2D8B-06CE-4E1A-931A-5A0E2F6E4D61 /Library/CalendarServer/Documents/calendars/__uids__/


    3. Modify Wiki migration Python script

    First make a backup of the script:

    sudo cp /System/Library/ServerSetup/MigrationExtras/95-wiki_calendar_migrator.py /System/Library/ServerSetup/MigrationExtras/95-wiki_calendar_migrator.py.bak

    Then edit the script w/ a text editor:

    sudo pico /System/Library/ServerSetup/MigrationExtras/95-wiki_calendar_migrator.py

    Change the path of the "oldCalendarDir" variable on Line 146 from:

    oldCalendarDir = pathJoin(options.sourceRoot, calendarDocumentRoot, '/calendars/__uids__/', oldGUID, '/calendar/')

    to

    oldCalendarDir = pathJoin(options.sourceRoot, calendarDocumentRoot, '/calendars/__uids__/', oldGUID, '/')

    Make this same path change on Line 151 as well.


    4. Cross your fingers and run the script!

    Simply run the script as a command now:

    sudo /System/Library/ServerSetup/MigrationExtras/95-wiki_calendar_migrator.py /System/Library/ServerSetup/MigrationExtras/95-wiki_calendar_migrator.py

    If all went well, you should see the same .ics files and .db.sqlite files that were in the original location moved into the following spot:

    /Library/CalendarServer/Documents/calendars/__uids__/wi/ki/wiki-groupname


    5. Add account to iCal and verify the old calendars show up

    Configure the account w/ the following path:

    /principals/__uids__/wiki-groupname