Univention Bugzilla – Bug 52942
wait_for_activation() waits for local to be registered filename
Last modified: 2021-05-25 15:58:47 CEST
ucsRegisterLDAPExtension (pretends to) wait for the extensions to be registered. So that after the listener module is finished joinscript continue. In case for UDM modules, syntaxes, hooks this returns immediately because it waits for the file to be registered to exists: 1024 class UniventionUDMExtension(six.with_metaclass(ABCMeta, UniventionLDAPExtension)): 1025 1026 » def wait_for_activation(self, timeout=180): 1027 » » # type: (int) -> bool 1028 » » if not UniventionLDAPExtension.wait_for_activation(self, timeout): 1029 » » » return False 1030 1031 » » timeout = 60 1032 » » print("Waiting for file %s:" % (self.filename,), end=' ') 1033 » » t0 = time.time() 1034 » » while not os.path.exists(self.filename): 1035 » » » if time.time() - t0 > timeout: 1036 » » » » print("ERROR") 1037 » » » » print("ERROR: Timeout waiting for %s." % (self.filename,), file=sys.stderr) 1038 » » » » return False 1039 » » » sys.stdout.write(".") 1040 » » » sys.stdout.flush() 1041 » » » time.sleep(3) 1042 » » print("OK") 1043 » » return True So it waits for e.g. /usr/lib/univention-portal/syntax/univention-portal.py instead of /usr/lib/python(2.7|3)/dist-packages/univention/admin/syntax.d/univention-portal.py. The Memberserver is currently not possible to upgrade to UCS 5.0 due to this: Waiting for activation of the extension object univention-portal: OK Waiting for activation of the extension object 62univention-portal: OK Waiting for activation of the extension object univention-portal: OK Waiting for file /usr/lib/univention-portal/syntax/univention-portal.py: OK Object exists: cn=udm_module,cn=univention,dc=autotest076,dc=local Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/univention/lib/ldap_extension.py", line 1507, in <module> commands[sys.argv.pop(1)]() File "/usr/lib/python3/dist-packages/univention/lib/ldap_extension.py", line 1392, in ucs_registerLDAPExtension univentionUDMModule.register(udm_module, opts, udm_passthrough_options) File "/usr/lib/python3/dist-packages/univention/lib/ldap_extension.py", line 1064, in register spec.loader.exec_module(mod) File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/usr/lib/univention-portal/udm/portal.py", line 97, in <module> syntax=univention.admin.syntax.NewPortalFontColor, AttributeError: module 'univention.admin.syntax' has no attribute 'NewPortalFontColor'
Another issue: Having multiple objects to be registered in one call calls wait_for_activation() only once after registering all of the objects: 1439 » for obj in objects: 1440 » » if not obj.wait_for_activation(): 1441 » » » print("%s: registraton of %s failed." % (functionname, obj.filename)) 1442 » » » sys.exit(1) → This causes that one have to split the registration of multiple components into multiple ucsRegisterLDAPExtension calls. I think we won't fix it here now.
The wait mechanism has been adjusted so that it uses the most probably filename and check for their existence, it also checks if a UDM module is available/importable. The wait mechanism is now only done if the startucsversion and enducsversion matches. Otherwise the waiting always used the full time and always failed. univention-lib (9.0.11-2) 1b93872e13f6 | Bug #52942: do not wait_for_activation() if the target UCS version does not match 7edbb3ac2d76 | Bug #52942: fix wait_for_activation() waiting for the actual file changelog-5.0-0.xml e927af7f893c | Changelog Bug #52942
(In reply to Florian Best from comment #2) > The wait mechanism has been adjusted so that it uses the most probably > filename and check for their existence, it also checks if a UDM module is > available/importable. → OK > The wait mechanism is now only done if the startucsversion and enducsversion > matches. Otherwise the waiting always used the full time and always failed. → OK OK: code change OK: functional change OK: installation OK: update OK: ucs-test OK: changelog entry OK: changelog xml
UCS 5.0 has been released: https://docs.software-univention.de/release-notes-5.0-0-en.html https://docs.software-univention.de/release-notes-5.0-0-de.html If this error occurs again, please use "Clone This Bug".