tpokorra / KolabScripts

some scripts useful for Kolab3 and higher, written by TBits.net, including patches already submitted to Kolab Bugzilla
14 stars 13 forks source link

tests fail with internal error #73

Closed tpokorra closed 8 years ago

tpokorra commented 8 years ago

on my nightly builds, I often get this error, though it cannot be reproduced easily:

[00:52:37] ======================================================================
[00:52:37] FAIL: test_edit_user_himself (__main__.KolabWAPCreateUserAndEditSelf)
[00:52:37] ----------------------------------------------------------------------
[00:52:37] Traceback (most recent call last):
[00:52:37]   File "./testCreateUserAndEditSelf.py", line 50, in test_edit_user_himself
[00:52:37]     self.helper_user_edits_himself()
[00:52:37]   File "./testCreateUserAndEditSelf.py", line 31, in helper_user_edits_himself
[00:52:37]     self.assertEquals("User updated successfully.", elem.text, "User was not saved successfully, message: " + elem.text)
[00:52:37] AssertionError: User was not saved successfully, message: Internal error
[00:52:37] 
[00:52:37] ======================================================================
[00:52:37] FAIL: test_edit_user_himself_multi_domain_with_quota (__main__.KolabWAPCreateUserAndEditSelf)
[00:52:37] ----------------------------------------------------------------------
[00:52:37] Traceback (most recent call last):
[00:52:37]   File "./testCreateUserAndEditSelf.py", line 70, in test_edit_user_himself_multi_domain_with_quota
[00:52:37]     self.helper_user_edits_himself()
[00:52:37]   File "./testCreateUserAndEditSelf.py", line 31, in helper_user_edits_himself
[00:52:37]     self.assertEquals("User updated successfully.", elem.text, "User was not saved successfully, message: " + elem.text)
[00:52:37] AssertionError: User was not saved successfully, message: Internal error
[00:52:37] 
[00:52:37] ----------------------------------------------------------------------
tpokorra commented 8 years ago

the error in /var/log/kolab-webadmin/errors:

[05-Aug-2016 08:14:49 Europe/Berlin] PHP Warning:  ldap_mod_del(): Modify: Insufficient access in /usr/share/php/Net/LDAP3.php on line 2340
[05-Aug-2016 08:15:48 Europe/Berlin] PHP Warning:  ldap_mod_del(): Modify: Insufficient access in /usr/share/php/Net/LDAP3.php on line 2340
tpokorra commented 8 years ago

works in vanilla mode, does not work after initMultiDomain/initTBitsISP, but works after a restart?

tpokorra commented 8 years ago

enabled debug_mode in kolab.conf

[kolab_wap]
debug_mode = TRACE

will see if that shows what ldap attribute causes the problem

tpokorra commented 8 years ago
[05-Aug-2016 10:40:21 +0200](tg3g7ecb4q7r198k0ihhka1p83): [WARNING] (api) LDAP: Failed to delete attributes on uid=user20160805103955,ou=People,dc=lbs,dc=solidcharity,dc=com: {"mailhost":["localhost"]}

Indeed, in /tmp/output20160805104022.html, value of mailhost is empty:

 <td class="label">Email Server</td>
<td class="value"><input type="text" readonly="readonly" name="mailhost" class="readonly maxsize" size="40"></td>

/var/log/kolab-webadmin/console: there is no mailhost attribute, although it was part of the search:

[05-Aug-2016 10:40:18 +0200](tg3g7ecb4q7r198k0ihhka1p83): [DEBUG] (api) Auth::LDAP::_read() result: array (
  'uid=user20160805103955,ou=People,dc=lbs,dc=solidcharity,dc=com' =>
  array (
    'cn' => 'user20160805103955 user20160805103955',
    'displayname' => 'user20160805103955, user20160805103955',
    'uid' => 'user20160805103955',
    'userpassword' => '{SSHA}TQWDkMNyPtq275yOR98ZwaxE9Rk1xhvwi2AWmA==',
    'givenname' => 'user20160805103955',
    'mail' => 'user20160805103955.user20160805103955@lbs.solidcharity.com',
    'sn' => 'user20160805103955',
    'objectclass' =>
    array (
      0 => 'inetorgperson',
      1 => 'kolabinetorgperson',
      2 => 'mailrecipient',
      3 => 'organizationalperson',
      4 => 'person',
      5 => 'top',
      6 => 'tbitskolabuser',
    ),
    'preferredlanguage' => 'en_US',
    'alias' =>
    array (
      0 => 'u.user20160805103955@lbs.solidcharity.com',
      1 => 'user20160805103955@lbs.solidcharity.com',
    ),
    'mailquota' => '1048576',
    'nsuniqueid' => '24f00101-5ae811e6-89739063-3bab3138',
  ),
)
tpokorra commented 8 years ago

just thinking: is mailhost set by kolabd? do I need to wait a little bit longer after creating the user? or force the sync?

running kolab -d 9 sync does not do it. but with systemctl stop kolabd localhost will not be set

/usr/lib/python2.7/site-packages/kolabd: __init__.py added_domains does not just contain new domains, but also modified domains, eg. new user

solution:

pykolab/cli/cmd_sync.py: auth.synchronize(mode='_paged_search', callback=queue_add) change to auth.synchronize()

queue_add will use a local _synchronize method, which only creates the imap mailbox, but does not call the things that LDAP _synchronize calls, when using the default callback

tpokorra commented 8 years ago

that does not seem to work. just hangs on Kolab 3.4, and takes much longer for Winterfell and Kolab 16