Bug 42862 - listener/udm_extension.py doesn't cleanup when file changes
listener/udm_extension.py doesn't cleanup when file changes
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.2-1-errata
Assigned To: Johannes Keiser
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-11-07 10:37 CET by Florian Best
Modified: 2017-07-05 13:06 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?:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments
patch (1.36 KB, patch)
2016-11-07 10:45 CET, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-11-07 10:37:33 CET
If the filename property of settings/udm_hook settings/udm_syntax settings/udm_module changes the corresponding python files aren't removed by the listener module udm_extension.py.

This causes several dead files after running the ucs-test script 72_udm-extensions/24_update_packageversion.

# ls /usr/share/pyshared/univention/admin/handlers/ucstest/
b1wwyprydy.py  cs2sapmzep.py  frng4064cp.py  __init__.py    krzdl9qjwl.py  r4046zqgjb.py  ue7apx0p4e.py  vde7jooqde.py  vzim57snkq.py  wudd92bykm.py
c76smp3n3w.py  ej0iyhq6vp.py  hq7c6wc7td.py  jw5ef80n1w.py  pzgpw74als.py  rht4gq9zmq.py  uxafemexbl.py  vljwxsi7sl.py  wprjh759ic.py  zdfypds6vc.py

# ls /usr/share/pyshared/univention/admin/hooks.d/
dv3t6owj7f.py  e21reckhtz.py  furj3agw0s.py  gpxxx3v08e.py  __init__.py  lumr3d2tel.py  ogrqmcm85g.py  s7xlbkk9if.py  schoolAdminGroup.py  schoolOU.py  ucsschool_user_options.py  utg5k6hrrg.py  wfj338v6kq.py  xmpgzkt03w.py

# ls /usr/share/pyshared/univention/admin/syntax.d/
example.py  hisxvb6njt.py  jhg9gpbxke.py  kqw98el8fa.py  kvs9vq1ott.py  mbon8qutup.py  nn523am0uk.py  q3ptxgdsom.py  qzh4ttvrim.py  samlserviceprovider.py  syntax.ucs-school-import.py  tk8q3z1xkb.py  ucc.py  univention-virtual-machine-manager-schema.py  zy9lds4etn.py
Comment 1 Florian Best univentionstaff 2016-11-07 10:45:12 CET
Created attachment 8194 [details]
patch
Comment 2 Johannes Keiser univentionstaff 2017-07-03 14:53:12 CEST
(In reply to Florian Best from comment #1)
> Created attachment 8194 [details]
> patch

Applied patch:

r 80782
univention-directory-manager-modules (12.0.17-50) 
* Bug #42862: Applied patch from Florian Best - Fix listener/udm_syntax.py
not cleaning up files

YAML: r 80785
Comment 3 Florian Best univentionstaff 2017-07-03 15:10:27 CEST
OK: test:
service univention-directory-listener restart
ucs-test 72_udm-extensions/24_update_packageversion
ls /usr/share/pyshared/univention/admin/handlers/ucstest/ /usr/share/pyshared/univention/admin/hooks.d/ /usr/share/pyshared/univention/admin/syntax.d/

OK: YAML (adjusted in r80787)
Comment 4 Florian Best univentionstaff 2017-07-04 12:03:22 CEST
Traceback (most recent call last):
  File "/usr/lib/univention-directory-listener/system/udm_extension.py", line 104, in handler
    old_relative_filename = old.get('%sFilename' % objectclass)[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
Comment 5 Johannes Keiser univentionstaff 2017-07-04 12:18:02 CEST
(In reply to Florian Best from comment #4)
> Traceback (most recent call last):
>   File "/usr/lib/univention-directory-listener/system/udm_extension.py",
> line 104, in handler
>     old_relative_filename = old.get('%sFilename' % objectclass)[0]
> TypeError: 'NoneType' object has no attribute '__getitem__'

r 80813
univention-directory-manager-modules (12.0.17-54) 
* Bug #42862: Applied patch from Florian Best - Prevent crash if old file
does not exist
Comment 6 Florian Best univentionstaff 2017-07-04 14:01:19 CEST
OK: the tests work now again.
I added another ucs-test case which tests the removal of renamed files:

ucs-test (7.0.22-16):
r80815 | Bug #42862: add test for renamed filenames causes old files to be removed
Comment 7 Janek Walkenhorst univentionstaff 2017-07-05 13:06:33 CEST
<http://errata.software-univention.de/ucs/4.2/79.html>