[CalendarServer-changes] [3503] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 10 11:16:37 PST 2008


Revision: 3503
          http://trac.macosforge.org/projects/calendarserver/changeset/3503
Author:   sagen at apple.com
Date:     2008-12-10 11:16:36 -0800 (Wed, 10 Dec 2008)
Log Message:
-----------
Remove service locator call, and have ServerHostName default to localhost if not specified in caldavd.plist

Modified Paths:
--------------
    CalDAVTester/trunk/odsetup.py
    CalDAVTester/trunk/src/serverinfo.py

Modified: CalDAVTester/trunk/odsetup.py
===================================================================
--- CalDAVTester/trunk/odsetup.py	2008-12-10 19:04:56 UTC (rev 3502)
+++ CalDAVTester/trunk/odsetup.py	2008-12-10 19:16:36 UTC (rev 3503)
@@ -218,25 +218,7 @@
     finally:
         fd.close()
 
-def getServiceLocator(hostname):
-    cmd = "dscl -u %s -P %s %s -read /Computers/%s GeneratedUID"  % (diradmin_user, diradmin_pswd, directory_node, hostname)
-    result = commands.getoutput(cmd)
-    guid = result.split()[1]
 
-    cmd = "dscl -u %s -P %s %s -read /Computers/%s dsAttrTypeNative:apple-serviceinfo"  % (diradmin_user, diradmin_pswd, directory_node, hostname)
-    result = commands.getoutput(cmd)
-    plist = readPlistFromString(result[result.find("<?xml"):])
-    vhosts = plist.get("com.apple.macosxserver.virtualhosts", None)
-    for key, value in vhosts.iteritems():
-        serviceTypes = value.get("serviceType", None)
-        if serviceTypes:
-            for type in serviceTypes:
-                if type == "calendar":
-                    vhostguid = key
-                    break
-
-    return "%s:%s:calendar" % (guid, vhostguid,)
-
 def addLargeCalendars(hostname, docroot):
     calendars = ("calendar.10", "calendar.100", "calendar.1000",)
     path = os.path.join(docroot, "calendars/users/user01")    
@@ -367,9 +349,6 @@
             # Patch the sudoers file for the superuser principal.
             patchSudoers(sudoers)
     
-            # Get the ServiceLocator details we need to enable calendar users.
-            service_locator = getServiceLocator(hostname)
-    
             # Now generate the OD accounts (caching guids as we go).
             doToAccounts(createUser)
             
@@ -389,9 +368,6 @@
             # Read the caldavd.plist file and extract some information we will need.
             hostname, docroot, sudoers = readConfig(config)
             
-            # Get the ServiceLocator details we need to enable calendar users.
-            service_locator = getServiceLocator(hostname)
-    
             # Now generate the OD accounts (caching guids as we go).
             doToAccounts(createUser, users_only=True)
             

Modified: CalDAVTester/trunk/src/serverinfo.py
===================================================================
--- CalDAVTester/trunk/src/serverinfo.py	2008-12-10 19:04:56 UTC (rev 3502)
+++ CalDAVTester/trunk/src/serverinfo.py	2008-12-10 19:16:36 UTC (rev 3503)
@@ -22,7 +22,7 @@
 
 class serverinfo( object ):
     """
-    Maintains information about the server beiung targetted.
+    Maintains information about the server being targetted.
     """
     __slots__  = ['host', 'port', 'authtype', 'ssl', 'calendarpath', 'user', 'pswd', 'serverfilepath', 'subsdict', 'extrasubsdict',]
 
@@ -69,7 +69,10 @@
     def parseXML( self, node ):
         for child in node._get_childNodes():
             if child._get_localName() == src.xmlDefs.ELEMENT_HOST:
-                self.host = child.firstChild.data.encode("utf-8")
+                try:
+                    self.host = child.firstChild.data.encode("utf-8")
+                except:
+                    self.host = "localhost"
             elif child._get_localName() == src.xmlDefs.ELEMENT_PORT:
                 self.port = int( child.firstChild.data )
             elif child._get_localName() == src.xmlDefs.ELEMENT_AUTHTYPE:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081210/463da365/attachment-0001.html>


More information about the calendarserver-changes mailing list