Bug 50415 - every modules.update() calls import_{syntax,hook}_files() and UCS@school makes modules.update() in a hook
every modules.update() calls import_{syntax,hook}_files() and UCS@school make...
Status: NEW
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-10-25 17:33 CEST by Florian Best
Modified: 2019-10-25 17:33 CEST (History)
0 users

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
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 Florian Best univentionstaff 2019-10-25 17:33:26 CEST
univention.admin.modules.update() calls:
* univention.admin.syntax.import_syntax_files()
* univention.admin.hook.import_hook_files()

modules.update() is called during import in:

virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/uvmm_ldap.py:univention.admin.modules.update()
virtualization/univention-virtual-machine-manager-daemon/umc/python/uvmm/profiles.py:univention.admin.modules.update()

and in UCS@school:
ucs-school-lib/python/models/__init__.py:udm_modules.update()
ucs-school-lib/python/models/school.py:                 univention.admin.modules.update()
ucs-school-lib/python/roleshares.py:udm_modules.update()
ucs-school-lib/python/schoolldap.py:udm_modules.update()

When having UCS@school and UVMM and some other things installed there are a lot of syntaxes/hooks:

# ls /usr/share/pyshared/univention/admin/hooks.d/
office365_userPrincipalName_hook.py  schoolAdminGroup.py  schoolOU.py  ucsschool_purge_timestamp.py  ucsschool_role_computers.py  ucsschool_user_options.py

# ls /usr/share/pyshared/univention/admin/syntax.d/
app_syntax.py  office365.py  samlserviceprovider.py  syntax.ucs-school-import.py  univention-virtual-machine-manager-schema.py

The hook /usr/share/pyshared/univention/admin/hooks.d/ucsschool_role_computers.py import "ucsschool.lib.models":
This then calls univention.admin.modules() again.

So the syntax files are loaded twice during:
python -c "import univention.admin.modules; univention.admin.modules.update()".

This slows down the import.
We should enhance the situation! I don't find the bug anymore but I once already suggested to call modules.update() in univention/admin/__init__.py and remove all update() calls in other scripts/libs and let UDM handle all things itself. See also Bug #49923.