apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
486 stars 136 forks source link

Error running carddav server in Linux #285

Closed macosforgebot closed 13 years ago

macosforgebot commented 14 years ago

dave@… originally submitted this as ticket:358


When trying to launch the carddav server on a Debian Etch machine with ./run, I get the error:

ImportError: No module named open directory

I've tried commenting out all opendirectory-related resources in carddavd-dev.plist, but still get the error. I understand that there is no opendirectory on Linux, but there doesn't seem to be a way of keeping the server from trying to load that module.

Full traceback below.

exec python /home/dave/Twisted/bin/twistd  -n carddav -f /home/dave/ContactsServer/conf/carddavd-dev.plist -o ProcessType=Combined 
Traceback (most recent call last):
  File "/home/dave/Twisted/bin/twistd", line 21, in <module>
    run()
  File "/home/dave/Twisted/twisted/scripts/twistd.py", line 27, in run
    app.run(runApp, ServerOptions)
  File "/home/dave/Twisted/twisted/application/app.py", line 374, in run
    config.parseOptions()
  File "/home/dave/Twisted/twisted/application/app.py", line 354, in parseOptions
    usage.Options.parseOptions(self, options)
  File "/home/dave/Twisted/twisted/python/usage.py", line 184, in parseOptions
    for (cmd, short, parser, doc) in self.subCommands:
  File "/home/dave/Twisted/twisted/application/app.py", line 365, in subCommands
    self.loadedPlugins[plug.tapname] = plug
  File "/home/dave/ContactsServer/twisted/plugins/carddav.py", line 13, in getProperty
    return getattr(reflect.namedClass(self.serviceMakerClass), propname)
  File "/home/dave/Twisted/twisted/python/reflect.py", line 347, in namedObject
    module = namedModule(string.join(classSplit[:-1], '.'))
  File "/home/dave/Twisted/twisted/python/reflect.py", line 335, in namedModule
    topLevel = __import__(name)
  File "/home/dave/ContactsServer/addressbookserver/tap/carddav.py", line 84, in <module>
    from twistedcaldav.static import AddressBookHomeProvisioningFile, DirectoryBackedAddressBookFile
  File "/home/dave/ContactsServer/twistedcaldav/static.py", line 78, in <module>
    from twistedcaldav.directory.addressbook import uidsResourceName as uidsResourceNameAddressBook
  File "/home/dave/ContactsServer/twistedcaldav/directory/addressbook.py", line 45, in <module>
    from twistedcaldav.report_addressbook_findshared import getReadWriteSharedAddressBookGroups, getReadOnlySharedAddressBookGroups, getWritersGroupForSharedAddressBookGroup
  File "/home/dave/ContactsServer/twistedcaldav/report_addressbook_findshared.py", line 30, in <module>
    import opendirectory
ImportError: No module named open directory
macosforgebot commented 14 years ago

dennis@… originally submitted this as comment:1:⁠ticket:358

macosforgebot commented 14 years ago

dennis@… originally submitted this as comment:2:⁠ticket:358


By enabling the build of PyOpenDirectory on linux, I was enable to get the server up.

macosforgebot commented 14 years ago

guy@… originally submitted this as comment:3:⁠ticket:358


Replying to dennis@…:

By enabling the build of PyOpenDirectory on linux, I was enable to get the server up.

Please can you provide some simple steps for this?

macosforgebot commented 14 years ago

dennis@… originally submitted this as comment:4:⁠ticket:358


By editing the run script and comment out the check on darwin where PyOpenDirectory is fetched and build.

This makes the server start, but I haven't been able to connect to it using a Address Book client. But this could be a configuration error on my side.

macosforgebot commented 14 years ago

guy@… originally submitted this as comment:5:⁠ticket:358


which revision did you have checked out? I'm still not getting this work complete. I've checked out the latest:

http://svn.calendarserver.org/repository/calendarserver/ContactsServer Revision: 5050

macosforgebot commented 14 years ago

dennis@… originally submitted this as comment:6:⁠ticket:358


I checked out trunk, which seems to be revision 4952. But I had no problem doing it with revision 5050 either.

My changes in run is:

[ContactServer]$ svn diff run 
Index: run
===================================================================
--- run (revision 5050)
+++ run (working copy)
@@ -30,7 +30,7 @@
 ##

 set -e
-set -u
+#set -u

 wd="$(cd "$(dirname "$0")" && pwd)";

@@ -558,7 +558,7 @@
 # PyOpenDirectory
 #

-if [ "$(uname -s)" == "Darwin" ]; then
+#if [ "$(uname -s)" == "Darwin" ]; then
 #  if ! py_have_module opendirectory; then
     opendirectory="${top}/PyOpenDirectory";

@@ -568,7 +568,7 @@

     export PYTHONPATH="${PYTHONPATH}:${opendirectory}/build/${py_platform_libdir}";
 #  fi;
-fi;
+#fi;

 #
 # xattr
macosforgebot commented 14 years ago

dennis@… originally submitted this as comment:7:⁠ticket:358


Trying again with code block:

[dennis@blackbox3 ContactServer]$ svn diff run 
Index: run
===================================================================
--- run (revision 5050)
+++ run (working copy)
@@ -30,7 +30,7 @@
 ##

 set -e
-set -u
+#set -u

 wd="$(cd "$(dirname "$0")" && pwd)";

@@ -558,7 +558,7 @@
 # PyOpenDirectory
 #

-if [ "$(uname -s)" == "Darwin" ]; then
+#if [ "$(uname -s)" == "Darwin" ]; then
 #  if ! py_have_module opendirectory; then
     opendirectory="${top}/PyOpenDirectory";

@@ -568,7 +568,7 @@

     export PYTHONPATH="${PYTHONPATH}:${opendirectory}/build/${py_platform_libdir}";
 #  fi;
-fi;
+#fi;

 #
 # xattr
macosforgebot commented 14 years ago

guy@… originally submitted this as comment:8:⁠ticket:358


ok well it seems to compile now... however when it starts the server:

Starting server...
exec python /root/Twisted/bin/twistd  -n carddav -f /root/ContactServer2/conf/carddavd-dev.plist -o ProcessType=Combined 
Traceback (most recent call last):
  File "/root/Twisted/bin/twistd", line 21, in <module>
    run()
  File "/root/Twisted/twisted/scripts/twistd.py", line 27, in run
    app.run(runApp, ServerOptions)
  File "/root/Twisted/twisted/application/app.py", line 374, in run
    config.parseOptions()
  File "/root/Twisted/twisted/application/app.py", line 354, in parseOptions
    usage.Options.parseOptions(self, options)
  File "/root/Twisted/twisted/python/usage.py", line 184, in parseOptions
    for (cmd, short, parser, doc) in self.subCommands:
  File "/root/Twisted/twisted/application/app.py", line 365, in subCommands
    self.loadedPlugins[plug.tapname] = plug
  File "/root/ContactServer2/twisted/plugins/carddav.py", line 13, in getProperty
    return getattr(reflect.namedClass(self.serviceMakerClass), propname)
  File "/root/Twisted/twisted/python/reflect.py", line 347, in namedObject
    module = namedModule(string.join(classSplit[:-1], '.'))
  File "/root/Twisted/twisted/python/reflect.py", line 335, in namedModule
    topLevel = __import__(name)
  File "/root/ContactServer2/addressbookserver/tap/carddav.py", line 71, in <module>
    from twistedcaldav.resource import CalDAVResource
  File "/root/ContactServer2/twistedcaldav/resource.py", line 42, in <module>
    from twisted.web2.dav.idav import IDAVPrincipalCollectionResource
ImportError: cannot import name IDAVPrincipalCollectionResource
macosforgebot commented 14 years ago

rene@… originally submitted this as comment:9:⁠ticket:358

macosforgebot commented 14 years ago

rene@… originally submitted this as comment:10:⁠ticket:358


I can confirm the error, and also the workaround.

macosforgebot commented 14 years ago

alexis@… originally submitted this as comment:11:⁠ticket:358

macosforgebot commented 13 years ago

@wsanchez originally submitted this as comment:12:⁠ticket:358

macosforgebot commented 13 years ago

@wsanchez originally submitted this as comment:13:⁠ticket:358


It should no longer be necessary to try to force build PyOpenDirectory. Try again with trunk.