Univention Bugzilla – Bug 41659
unify computers/* code
Last modified: 2019-08-02 17:21:31 CEST
There is a lot of redundant code in the computers/* UDM handlers. Especially the open/_ldap_addlist/_ldap_modlist/_ldap_{pre,post}_{create,modify,delete} methods are nearly the same in every handler. We should outsource that code into external classes/methods/functions.
Created attachment 7781 [details] patch Attached a patch which behaves exactly the same as before except: * when creating a domaincontroller_master / windows_domaincontroller the 'kerberos' option is removed if univention.admin.uldap.domain(self.lo, self.position).getKerberosRealm() returns None. → This is the behavior of DC {backup,slave,memberserver} and should be okay here, too. * The 'computers/memberserver' lookup() functions finds memberserver only if they have univentionServerRole=='member' set. This is automatically set when creating a memberserver.
*** Bug 27857 has been marked as a duplicate of this bug. ***
Created attachment 8993 [details] patch (rebased to r80805)
This issue has been filled against UCS 4.1. The maintenance with bug and security fixes for UCS 4.1 has ended on 5st of April 2018. Customers still on UCS 4.1 are encouraged to update to UCS 4.3. Please contact your partner or Univention for any questions. If this issue still occurs in newer UCS versions, please use "Clone this bug" or simply reopen the issue. In this case please provide detailed information on how this issue is affecting you.
I splitted the fix into 3 commits: * The first commit is the patch I already had, slightly changed. * The second commit makes sure that no behavior change exists: (In reply to Florian Best from comment #1) > Attached a patch which behaves exactly the same as before except: > * when creating a domaincontroller_master / windows_domaincontroller the > 'kerberos' option is removed if univention.admin.uldap.domain(self.lo, > self.position).getKerberosRealm() returns None. > → This is the behavior of DC {backup,slave,memberserver} and should be okay > here, too. > * The 'computers/memberserver' lookup() functions finds memberserver only if > they have univentionServerRole=='member' set. This is automatically set when > creating a memberserver. Both points are reverted to the old behavior. Maybe this is unnecessary, but who knows?! The third commits adds some extra things because UDM has evolved since 2016 and some features of that can be used. univention-directory-manager-modules (14.0.12-4) 9ff4a2152768 | Bug #41659: Merge branch 'fbest/41659-unify-computers' into 4.4-0 1234da7da7e5 | Bug #41659: further adjustments to current UDM f4d198f8c55d | Bug #41659: make behavior equal to prior 79b616a8f27e | Bug #41659: unify computer/* handlers to share a common python base univention-directory-manager-modules (14.0.12-5) 52409a26e6a7 | Bug #41659: all computer/* handlers have been unified into one base class univention-directory-manager-modules (14.0.12-6) ccf036f7c9e8 | Bug #41659: use ln -snf (Feedback from QA) univention-directory-manager-modules.yaml 7a707c26b06e | YAML Bug #41659
OK: ccf036f7c9 Bug #41659: use ln -snf (Feedback from QA) OK: 7a707c26b0 YAML Bug #41659 OK: 52409a26e6 Bug #41659: all computer/* handlers have been unified into one base class OK: 9ff4a21527 Bug #41659: Merge branch 'fbest/41659-unify-computers' into 4.4-0 OK: 1234da7da7 Bug #41659: further adjustments to current UDM OK: f4d198f8c5 Bug #41659: make behavior equal to prior OK: 79b616a8f2 Bug #41659: unify computer/* handlers to share a common python base OK: 66_udm-computers/22_all_roles_modification_append_and_remove_groups -vvvf OK: 66_udm-computers/22_all_roles_modification_append_and_remove_groups -vvvf
Typo, breaks jenkins: -» » » » » if not (ip in removedIPs or mac in removedMACs) +» » » » » if not (ip in removedIPs or _mac in removedMACs)
(In reply to Florian Best from comment #7) > Typo, breaks jenkins: > -» » » » » if not (ip in removedIPs or mac in removedMACs) > +» » » » » if not (ip in removedIPs or _mac in removedMACs) Please revert the change in handers/__init__.py from commit 1234da7da7e52a41d9321be6c85c8da207ca1a3a
60_umc.03_acls.test fails because of this, as far i as understood, the problem for the umc server is /usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py @classmethod def rewrite_filter(cls, filter, mapping): key = filter.variable mod = univention.admin.modules.get(cls.module) try: property_ = mod.property_descriptions.get(key) except Exception as exc: mod is None because modules.update() is missing
Both points fixed. Package has already been built.
OK: 8cce7e143605705db725d0b11881fc601e32f409 OK: 4da065177b5bd023cf3a15706a224d9af280d7d0 OK: bb03a8758bf0b909a2c78fed0e2ba7f54322425e OK: vimdiff handlers/computers/*.py OK: Jenkins
See https://forge.univention.org/bugzilla/show_bug.cgi?id=48895#c6. Looks like the new python file is not linked yet during the update process. Can you please check this?
(In reply to Dirk Wiesenthal from comment #12) > See https://forge.univention.org/bugzilla/show_bug.cgi?id=48895#c6. Looks > like the new python file is not linked yet during the update process. Can > you please check this? It is linked in preinst: python-univention-directory-manager.preinst:» ln -snf /usr/share/pyshared/univention/admin/handlers/computers/base.py /usr/lib/pymodules/python2.7/univention/admin/handlers/computers/base.py
univention-directory-manager-modules (14.0.12-17) e376c48f303b | Bug #41659: call update-python-modules explicit
OK: 3dbb99c814a11d2ab92fc3b16b36e8cc37cc009a OK: e376c48f303b41918bcf0b4733e1e0fe522f5584 OK: f458d7180dce6d8f8355bb4bee99654fe8861c72 OK: 76947b61f3c8fca3bdd3fcedb357f876afe3decd OK: grep ERROR /var/log/univention/listener.log OK: ucs-test -E dangerous -c -s udm-computers OK: http://jenkins.knut.univention.de:8080/job/UCS-4.4/job/UCS-4.4-0/view/Branch%20Tests/job/branch%20test%20base%20singlemaster/
<http://errata.software-univention.de/ucs/4.4/19.html>