Bug 57484 - UDM syntax call wrong
UDM syntax call wrong
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-8-errata
Assigned To: Arvid Requate
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-31 10:50 CEST by Fabian Schneider
Modified: 2024-09-04 17:51 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.103
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2024073021000089, 2024082021000186
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Schneider univentionstaff 2024-07-31 10:50:45 CEST
The UDM allocates syntax definitions in some cases as follows:

                                syntax = univention.admin.syntax.string()
                                setattr(prop, attr, syntax())
https://github.com/univention/univention-corporate-server/blob/5.0-8/management/univention-directory-manager-modules/modules/univention/admin/__init__.py#L113-L114

As an object is tried to be called, the following error is thrown:

root@ucs-3999:~# python3
Python 3.7.3 (default, Mar 23 2024, 16:12:05) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import univention.admin.syntax
>>> syntax = univention.admin.syntax.string()
>>> syntax()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'string' object is not callable
>>> syntax
<univention.admin.syntax.string object at 0x7f57ea153198>

The correct setattr call would likely be as follows:
setattr(prop, attr, syntax)
Comment 1 Finn David univentionstaff 2024-08-21 12:29:04 CEST
Another customer has this problem and this might be the cause for his current trouble with using group licenses which are sporadically missing in AAD.


19.08.24 11:05:42.800  ADMIN       ( ERROR   ) : ucr_overwrite_properties: failed to set property attribute:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/office365/udm_helper.py", line 151, in _get_module
    mod = self.modules[module_name]
KeyError: 'groups/group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/admin/__init__.py", line 114, in ucr_overwrite_properties
    setattr(prop, attr, syntax())
TypeError: 'string' object is not callable
19.08.24 11:05:42.941  ADMIN       ( ERROR   ) : ucr_overwrite_properties: failed to set property attribute:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/office365/udm_helper.py", line 151, in _get_module
    mod = self.modules[module_name]
KeyError: 'groups/group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/admin/__init__.py", line 114, in ucr_overwrite_properties
    setattr(prop, attr, syntax())
TypeError: 'string' object is not callable
Comment 5 Arvid Requate univentionstaff 2024-09-02 12:08:47 CEST
The traceback in the tickets probably was found in log files
because ucr_overwrite_properties uses log.exception(), but
it just does it to inform the customer that the syntax override
via UCR didn't work and continues. I adjusted the error message,
so the confusing traceback doesn't appear any longer.

But AFAICS the *logged* traceback should not have caused any issues,
as the code would continue running, just without the syntax override.
So on the front side of the problem, there may have been a typo in
the value of the customized UCR variable. As a result, this traceback
was logged and the program continues without an adjusted syntax. Maybe
*that* then caused further issues downstream, or it was just a red herring.

This update addresses the following issues:
* In case a UDM property syntax has been overridden via UCR but the
  specified value does not correspond to any defined syntax,
  UDM logged a traceback. This has now been replaced by a proper
  log message explaining the origin of the problem.

f0d8ac38e7 | Fixup for 8d2c488c4d9

Package: univention-directory-manager-modules
Version: 15.0.27-8
Branch: 5.0-0
Scope: errata5.0-8
Comment 6 Arvid Requate univentionstaff 2024-09-03 12:33:36 CEST
Lean verification:
* Code review done by colleague via issue.
* Test installation of package from apt successful
* Advisory ok
* ErrataValidation looks ok
Comment 7 Arvid Requate univentionstaff 2024-09-04 10:40:36 CEST
6ba61bf294 | cherry-pick to 5.2-0

Package: univention-directory-manager-modules
Version: 17.0.20
Branch: 5.2-0