Bug 48551 - udm/layout (groups/group): AttributeError: 'Group' object has no attribute 'append'
udm/layout (groups/group): AttributeError: 'Group' object has no attribute 'a...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.3
Other Linux
: P5 normal (vote)
: UCS 4.4-0-errata
Assigned To: Florian Best
Jannik Ahlers
:
: 24987 49570 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-31 13:18 CET by Johannes Keiser
Modified: 2019-06-03 10:03 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.200
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2019031421001643, 2019012821001157
Bug group (optional): Error handling, External feedback
Max CVSS v3 score:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Keiser univentionstaff 2019-01-31 13:18:00 CET
Version: 4.3-3 errata410 (Neustadt)

Remark: add a custum attribute with udm without errors

Internal server error during "udm/layout (groups/group)".
Request: udm/layout (groups/group)

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/base.py", line 253, in execute
    function.__func__(self, request, *args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 117, in _decoarated
    ret = [func(self, request) for request.options in options]
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 192, in _response
    return function(self, request)
  File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 831, in layout
    module.load(force_reload=True)  # reload for instant extended attributes
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 267, in load
    self.module = _module_cache.get(module, force_reload=force_reload)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 84, in _decorated
    return method(*args, **kwargs)
  File "%PY2.7%/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 236, in get
    udm_modules.init(ldap_connection, ldap_position, self[name], template_object, force_reload=force_reload)
  File "%PY2.7%/univention/admin/modules.py", line 140, in init
    update_extended_attributes(lo, module, position)
  File "%PY2.7%/univention/admin/modules.py", line 513, in update_extended_attributes
    item.append(ea_layout.label)
AttributeError: 'Group' object has no attribute 'append'

Role: domaincontroller_master
Comment 1 Florian Best univentionstaff 2019-03-13 10:35:55 CET
*** Bug 24987 has been marked as a duplicate of this bug. ***
Comment 2 Florian Best univentionstaff 2019-03-13 10:38:01 CET
Reproducible:
eval "$(ucr shell)"
udm settings/extended_attribute create \
        --position "cn=custom attributes,cn=univention,$ldap_base" \
        --set name=testProperty1 \
        --set objectClass=univentionFreeAttributes \
        --set ldapMapping=univentionFreeAttribute1 \
        --set module=users/user \
        --set tabName=Account \
        --set groupName=Windows \
        --set overwritePosition=Windows \
        --set shortDescription="Test Field 1"

If that occurrs, the whole UDM is not usable anymore:

# udm users/user list
Traceback (most recent call last):
  File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 218, in doit
    output = univention.admincli.admin.doit(arglist)
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 408, in doit
    out = _doit(arglist)
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 623, in _doit
    univention.admin.modules.init(lo, position, module)
  File "/usr/lib/pymodules/python2.7/univention/admin/modules.py", line 140, in init
    update_extended_attributes(lo, module, position)
  File "/usr/lib/pymodules/python2.7/univention/admin/modules.py", line 537, in update_extended_attributes
    item.append(ea_layout.label)
AttributeError: 'Group' object has no attribute 'append'
Comment 3 Florian Best univentionstaff 2019-03-13 10:54:39 CET
Patch available in fbest/48551-extended-attribute-layout.

diff --git a/management/univention-directory-manager-modules/modules/univention/admin/modules.py b/management/univention-directory-manager-modules/modules/univention/admin/modules.py
index 66d21b06d7..25d8a805ef 100644
--- a/management/univention-directory-manager-modules/modules/univention/admin/modules.py
+++ b/management/univention-directory-manager-modules/modules/univention/admin/modules.py
@@ -537 +537 @@ def update_extended_attributes(lo, module, position):
-»   »   »   »   »   »   »   »   »   item.append(ea_layout.label)
+»   »   »   »   »   »   »   »   »   item.layout.append(ea_layout.label)
Comment 4 Florian Best univentionstaff 2019-03-13 11:13:38 CET
The bug has been introduced by Bug #23988:
commit d56dd9692197b6acb4d7961627a7017c41a04b2a
Date:   Mon Oct 17 15:22:54 2011 +0000

EA_Layout never had a .layout attribute.
One of the errors back then has been fixed by Bug #28629 but they missed the second/this error.

commit 26fddab7d000118025e3fafda7a834c70b5b7249
Date:   Wed Oct 30 13:29:18 2013 +0000
Comment 5 Andreas Burkert 2019-03-21 10:48:44 CET
Hi!

We ran into the same problem in a customer environment with UCS 4.4-0 Errata 5. We tried the proposed patch, but this resulted in a new error message, until we changed the line to

+»   »   »   »   »   »   »   »   »   item.layout.append(ea_layout.name)

We haven't done an in-depth code analysis, it was more of a guess. Could this work or have we created a possible new problem?
Comment 6 Florian Best univentionstaff 2019-03-21 10:59:15 CET
(In reply to Andreas Burkert from comment #5)
> Hi!
> 
> We ran into the same problem in a customer environment with UCS 4.4-0 Errata
> 5. We tried the proposed patch, but this resulted in a new error message,
> until we changed the line to
> 
> +»   »   »   »   »   »   »   »   »   item.layout.append(ea_layout.name)
> 
> We haven't done an in-depth code analysis, it was more of a guess. Could
> this work or have we created a possible new problem?

Oups, your line is the correct one. I did copy my old patch.
Comment 7 Johannes Keiser univentionstaff 2019-03-22 13:40:52 CET
Reported again: Version: 4.4-0 errata0 (Blumenthal) - UCS@school 4.4 v1

Internal server error during "schoolexam/exam/start".
Request: schoolexam/exam/start

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/base.py", line 253, in execute
    function.__func__(self, request, *args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 192, in _response
    return function(self, request)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 636, in _decorated
    return function(self, request, *args, **kwargs)
  File "%PY2.7%/ucsschool/lib/schoolldap.py", line 145, in wrapper_func
    return func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/schoolexam/__init__.py", line 188, in start_exam
    sender = util.distribution.openRecipients(self.user_dn, ldap_user_read)
  File "%PY2.7%/univention/management/console/modules/distribution/util.py", line 199, in openRecipients
    user = ucsschool.lib.models.User.from_dn(entryDN, None, ldap_connection)
  File "%PY2.7%/ucsschool/lib/models/base.py", line 914, in from_dn
    cls.init_udm_module(lo)
  File "%PY2.7%/ucsschool/lib/models/base.py", line 776, in init_udm_module
    udm_modules.init(lo, pos, udm_modules.get(cls._meta.udm_module))
  File "%PY2.7%/univention/admin/modules.py", line 140, in init
    update_extended_attributes(lo, module, position)
  File "%PY2.7%/univention/admin/modules.py", line 537, in update_extended_attributes
    item.append(ea_layout.label)
AttributeError: 'Group' object has no attribute 'append'

Role: domaincontroller_master
Comment 8 Florian Best univentionstaff 2019-04-11 09:09:52 CEST
The patch has been applied.

univention-directory-manager-modules (14.0.12-20)
1a0e6f57e1df | Bug #48551: fix extended attribute layout when group is not available

univention-directory-manager-modules.yaml
9762eb559436 | YAML Bug #48551
Comment 9 Jannik Ahlers univentionstaff 2019-04-11 16:24:25 CEST
730de16 Bug #48551: adjust wording in yaml
I made a slight enhancement to the wording of the yaml.

traceback doesn't appear - OK
yaml - OK
installation - OK
Comment 10 Erik Damrose univentionstaff 2019-04-17 14:08:09 CEST
<http://errata.software-univention.de/ucs/4.4/50.html>
Comment 11 Florian Best univentionstaff 2019-06-03 10:03:04 CEST
*** Bug 49570 has been marked as a duplicate of this bug. ***