Bug 38856 - Traceback creating existing UDM object with policies
Traceback creating existing UDM object with policies
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - CLI
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2-1-errata
Assigned To: Johannes Keiser
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-08 10:10 CEST by Philipp Hahn
Modified: 2017-07-05 13:06 CEST (History)
2 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?: 1: Will affect a very 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.034
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:
hahn: Patch_Available+


Attachments
Patch tracebacks (1.99 KB, text/plain)
2015-07-08 10:10 CEST, Philipp Hahn
Details
Rebased patch (4.00 KB, patch)
2017-06-29 12:55 CEST, Johannes Keiser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2015-07-08 10:10:42 CEST
Created attachment 7009 [details]
Patch tracebacks

1. dn is re-assigned the exception instance
2. For existing objects the policies are applied, even when already referenced.

ucr set directory/manager/cmd/debug/level=4
eval "$(ucr shell ldap/base domainname)"
python /usr/share/pyshared/univention/admincli/admin.py dhcp/subnet create --logfile /dev/stderr --ignore_exists --superordinate cn=$domainname,cn=dhcp,$ldap_base --set subnet=192.168.122.0 --policy-reference cn=default-settings,cn=boot,cn=dhcp,cn=policies,$ldap_base --set subnetmask=255.255.255.0
...
... add dn=cn=192.168.122.0,cn=phahn.dev,cn=dhcp,dc=phahn,dc=dev err={'desc': 'Already exists'}
... mod dn=cn=192.168.122.0,cn=phahn.dev,cn=dhcp,dc=phahn,dc=dev ml=[('objectClass', '', 'univentionPolicyReference')]
...
Traceback (most recent call last):
  File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 222, in doit
    output = univention.admincli.admin.doit(arglist)
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 393, in doit
    out=_doit(arglist)
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 889, in _doit
    lo.modify(dn,[('objectClass','','univentionPolicyReference')])
  File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 414, in modify
    return self.lo.modify(dn, changes)
  File "/usr/lib/pymodules/python2.7/univention/uldap.py", line 460, in modify
    if dn.startswith(key+'='):
AttributeError: 'objectExists' object has no attribute 'startswith'
...
08.07.15 09:57:35.666  ADMIN       ( WARN    ) : Traceback (most recent call last):
  File "/usr/share/pyshared/univention/admincli/admin.py", line 393, in doit
    out=_doit(arglist)
  File "/usr/share/pyshared/univention/admincli/admin.py", line 890, in _doit
    lo.modify(dn,[('objectClass','','univentionPolicyReference')])
  File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 423, in modify
    raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg)
ldapError: Type or value exists: modify/add: objectClass: value #0 already exists
Comment 1 Johannes Keiser univentionstaff 2017-06-29 12:55:58 CEST
Created attachment 8985 [details]
Rebased patch

Applied rebased patch:

r 80609
univention-directory-manager-modules (12.0.17-24) 
* Bug #38856: Applied patch - Fix traceback when creating existing UDM
object with policies

YAML: r 80610
Comment 2 Florian Best univentionstaff 2017-06-29 14:41:40 CEST
OK: policy reference is not evaluated if object exists
OK: AttributeError: DN
OK: YAML (adjusted in r80618)

Added a test case:
r80617 | Bug #38856: add 59_udm/12_create_existing_object_does_not_policy_reference
Comment 3 Janek Walkenhorst univentionstaff 2017-07-05 13:06:20 CEST
<http://errata.software-univention.de/ucs/4.2/79.html>