Bug 49611 - UCS@school roles are not correctly loaded in the lib
UCS@school roles are not correctly loaded in the lib
Status: RESOLVED WONTFIX
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v2-errata
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-07 13:14 CEST by Ole Schwiegert
Modified: 2023-06-23 13:15 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 2: Will only affect a few 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.091
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 Ole Schwiegert univentionstaff 2019-06-07 13:14:04 CEST
If you get Computers with the school lib via SchoolComputer.get_all the roles are not correctly loaded the first time you use the function:

In [1]: from univention.admin.uldap import getAdminConnection


In [2]: from ucsschool.lib.models.computer import SchoolComputer


In [3]: lo,po=getAdminConnection()


In [4]: c1=SchoolComputer.get_all(lo, 'DEMOSCHOOL')[0]


In [5]: c1

Out[5]: WindowsComputer(name='C1', school='DEMOSCHOOL', dn='cn=C1,cn=computers,ou=DEMOSCHOOL,dc=realm1,dc=intranet')


In [6]: c1.ucsschool_roles

Out[6]: []


In [7]: c1.modify(lo)

---------------------------------------------------------------------------

ldapError                                 Traceback (most recent call last)

<ipython-input-7-37d852b82f23> in <module>()

----> 1 c1.modify(lo)


/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.pyc in modify(self, lo, validate, move_if_necessary)

    531 		'''

    532                 self.call_hooks('pre', 'modify')

--> 533                 success = self.modify_without_hooks(lo, validate, move_if_necessary)

    534                 if success:

    535                         self.call_hooks('post', 'modify')


/usr/lib/pymodules/python2.7/ucsschool/lib/models/computer.pyc in modify_without_hooks(self, lo, validate, move_if_necessary)

    218         def modify_without_hooks(self, lo, validate=True, move_if_necessary=None):

    219                 self.create_network(lo)

--> 220                 return super(SchoolComputer, self).modify_without_hooks(lo, validate, move_if_necessary)

    221 

    222         def get_ipv4_network(self):


/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.pyc in modify_without_hooks(self, lo, validate, move_if_necessary)

    557                         old_attrs = deepcopy(udm_obj.info)

    558                         self.modify_without_hooks_roles(udm_obj)

--> 559                         self.do_modify(udm_obj, lo)

    560                         # get it fresh from the database

    561                         self.set_dn(self.dn)


/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.pyc in do_modify(self, udm_obj, lo)

    591 		'''

    592                 self._alter_udm_obj(udm_obj)

--> 593                 udm_obj.modify(ignore_license=1)

    594 

    595         def move(self, lo, udm_obj=None, force=False):


/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.pyc in modify(self, modify_childs, ignore_license, serverctrls, response)

    640                         self.ready()

    641 

--> 642                         dn = self._modify(modify_childs, ignore_license=ignore_license, response=response)

    643                 except:

    644                         self._save_cancel()


/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.pyc in _modify(self, modify_childs, ignore_license, response, serverctrls)

   1310                 # FIXME: timeout without exception if objectClass of Object is not exsistant !!

   1311                 univention.debug.debug(univention.debug.ADMIN, 99, 'Modify dn=%r;\nmodlist=%r;\noldattr=%r;' % (self.dn, ml, self.oldattr))

-> 1312                 self.dn = self.lo.modify(self.dn, ml, ignore_license=ignore_license, serverctrls=serverctrls, response=response)

   1313                 if ml:

   1314                         self._write_admin_diary_modify()


/usr/lib/pymodules/python2.7/univention/admin/uldap.pyc in modify(self, dn, changes, exceptions, ignore_license, serverctrls, response)

    894                 except ldap.LDAPError as msg:

    895                         univention.debug.debug(univention.debug.LDAP, univention.debug.ALL, 'mod dn=%s err=%s' % (dn, msg))

--> 896                         raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg)

    897 

    898         def rename(self, dn, newdn, move_childs=0, ignore_license=False, serverctrls=None, response=None):


ldapError: Type or value exists: modify/add: ucsschoolRole: value #0 already exists


In [8]: c1.ucsschool_roles

Out[8]: ['win_computer:school:DEMOSCHOOL']


In [9]: c1.modify(lo)

Out[9]: True
Comment 1 Ole Schwiegert univentionstaff 2019-06-13 12:01:25 CEST
The workaround for some reason is to call from_dn or get_all once before. After that the subsequent calls work as expected.

This workaround has been used in Bug #48080 and should be removed once this bug is being fixed.
Comment 2 Jan-Luca Kiok univentionstaff 2023-06-23 13:15:26 CEST
This issue has been filed against UCS 4.4.

UCS 4.4 is out of maintenance and UCS components may have vastly changed in later releases. Thus, this issue is now being closed.

If this issue still occurs in newer UCS versions, please use "Clone this bug" or reopen this issue. In this case please provide detailed information on how this issue is affecting you.