'bool' object has no attribute 'lower' from pykolab/imap/_init_.py", line 832 after "pykolab.imap ERROR Could not create ..." (MIGMAK-751)
Open, 60Public

Description

pykolab 0.7.31
cyrus imapd 2.5.10-8.1

Creating a series of new users, one faild (this is just one example) and following this fail something delivers a bool value into "mailbox" which can't be made "lower".

2017-01-11 12:27:42,253 pykolab.imap INFO Creating new mailbox for user kolabtest2298.lhm@muenchen.de
2017-01-11 12:27:45,272 pykolab.imap INFO Creating new mailbox for user kolabtest2299.lhm@muenchen.de
2017-01-11 12:27:47,483 pykolab.imap INFO Creating new mailbox for user kolabtest2300.lhm@muenchen.de
2017-01-11 12:27:49,396 pykolab.imap INFO Creating new mailbox for user kolabtest2301.lhm@muenchen.de
2017-01-11 12:27:49,497 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:50,607 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:51,765 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:52,881 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:53,999 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:55,129 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:56,241 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:57,396 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:58,530 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:27:59,643 pykolab.imap ERROR Could not create folder 'user/kolabtest2301.lhm@muenchen.de'
2017-01-11 12:28:00,682 pykolab.imap ERROR Could not create the mailbox for user kolabtest2301.lhm@muenchen.de, aborting.
2017-01-11 12:28:00,682 pykolab.auth ERROR An error occured using _persistent_search: AttributeError("'bool' object has no attribute 'lower'",)
2017-01-11 12:28:00,683 pykolab.auth ERROR Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pykolab/auth/ldap/__init__.py", line 3065, in _search
    secondary_domains
  File "<string>", line 10, in <module>
  File "/usr/lib/python2.6/site-packages/pykolab/auth/ldap/__init__.py", line 2793, in _persistent_search
    secondary_domains=secondary_domains
  File "/usr/lib/python2.6/site-packages/pykolab/auth/ldap/__init__.py", line 2650, in _synchronize_callback
    entry['type']
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/pykolab/auth/ldap/__init__.py", line 1689, in _change_add_user
    server = self.imap.user_mailbox_server(folder)
  File "/usr/lib/python2.6/site-packages/pykolab/imap/__init__.py", line 832, in user_mailbox_server
    server = self.imap.find_mailfolder_server(mailbox.lower()).lower()
c

2017-01-11 12:32:34,406 pykolab.imap INFO Creating new mailbox for user kolabtest2301.lhm@muenchen.de

Details

Ticket Type
Task
vendel.colja renamed this task from 'bool' object has no attribute 'lower' from pykolab/imap/_init_.py", line 832 after "pykolab.imap ERROR Could not create ..." to 'bool' object has no attribute 'lower' from pykolab/imap/_init_.py", line 832 after "pykolab.imap ERROR Could not create ..." (MIGMAK-751).
vendel.colja updated the task description. (Show Details)

Proposed fix:

-- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1683,6 +1683,8 @@ class LDAP(pykolab.base.Base):
                     entry[mailserver_attribute]
                 )
 
+            if folder is false:
+                return
         else:
             folder = "user%s%s" % (self.imap.get_separator(),entry[result_attribute].lower())

I opened a duplicate bifrost for this at https://bifrost.kolabsystems.com/T21031 .
One of the cases should end up in a commit and a new pykolab version, I think.

petersen moved this task from Backlog to Development on the Bug Reports board.Jan 13 2017, 11:16 AM
petersen closed this task as Resolved.
petersen claimed this task.
machniak reopened this task as Open.Apr 5 2017, 12:13 PM
machniak added a project: PyKolab.

Re-opening, as this issue is not fixed in git.

machniak reassigned this task from petersen to vanmeeuwen.Jul 21 2017, 12:49 PM
machniak added a subscriber: petersen.

A low hanging fruit. Patch in my comment above.

pasik added a subscriber: pasik.Nov 25 2017, 2:33 PM