Bug 34421 - update-python-modules breaks register UDM extensions
update-python-modules breaks register UDM extensions
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: LDAP
UCS 3.2
All Linux
: P5 critical (vote)
: UCS 3.2-1-errata
Assigned To: Arvid Requate
Stefan Gohmann
:
: 34558 (view as bug list)
Depends on: 32405
Blocks: 34349 34559 35929
  Show dependency treegraph
 
Reported: 2014-03-28 21:38 CET by Philipp Hahn
Modified: 2014-09-15 12:33 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
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?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Troubleshooting
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2014-03-28 21:38:14 CET
+++ This bug was initially created as a clone of Bug #32405 +++
...
* It updates the Python links e.g. by calling update-python-modules -p

I don't know what called "update-python-modules -a -v -f" (maybe a package update, maybe a Python update, maybe a package removal), but doing this manually removed all UDM extensions:

# find syntax.d hooks.d handlers -iname \*ox\* | wc -l
24
# update-python-modules -a -v -f
...
# cd $PWD
# find syntax.d hooks.d handlers -iname \*ox\*

It looks like "update-python-modules" starts from scratch and removed the complete directory before creating it anew; because of that the "cd $PWD" is needed.
It only processes those modules listed in /usr/share/python-support/*.{public,private}.

# udm modules | grep ox

# cd /usr/share/pyshared/univention/admin
# find hooks.d syntax.d handlers -path \*ox\* -type f -exec bash -c 't=/usr/lib/pymodules/python2.6/univention/admin/$1;mkdir -p ${t%/*};ln -n -s $PWD/$1 $t;pycompile $t' -- {} \;
# udm modules | grep ox
  oxmail/oxcontext
  oxmail/oxdomain
  oxmail/oxfetchmailmulti
  oxmail/oxfetchmailsingle
  oxmail/oxfolder
  oxmail/oxlists
  oxmail/oxmail
  oxresources/oxresources
Comment 1 Philipp Hahn univentionstaff 2014-03-29 09:31:25 CET
This is triggered as soon as a Python package using python-support is installed - in my case it was triggered by
> /usr/bin/python /usr/sbin/update-python-modules ucs-test-framework.public
> /usr/bin/python /usr/sbin/update-python-modules --post-install

The bug doesn't manifest immediately, but as soon as univention-cli-server is restarted: Then the new instance no longer finds the modules.

I can reproduce the bug by doing the following on a new 3.2-1 Generic VM:

# udm settings/udm_syntax create --set name=Bug34421 --set filename=Bug34421.py --set data="$(bzip2 </usr/share/pyshared/univention/admin/syntax.d/example.py |base64)" --set package=bug34421 --set packageversion=34421

# udm settings/udm_syntax list --position cn=Bug34421,dc=phahn,dc=dev
DN: cn=Bug34421,dc=phahn,dc=dev
ARG: None
  ucsversionstart: None
  ucsversionend: None
  name: Bug34421
  package: bug34421
  active: TRUE
  packageversion: 34421
  data: QlpoOTFBWSZTWTX9SDkAAClfgAAwQOQ4EgIADAoqZ89gIAByM/UmCNohoPQgxBtJKMmNGkAHqZqGMapeZawdSqXoZnpSIiZoZlqG3Mgum23LKUuB05WRhXGvHvglZFwppXlfg99jUlbFLdDH+ZQtg8NMhmV2jEa4BYMMtf8XckU4UJA1/Ug5
  filename: Bug34421.py

# stat /usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py 
  File: „/usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py“ -> „/usr/share/pyshared/univention/admin/syntax.d/Bug34421.py“
  Size: 57              Blocks: 0          IO Block: 4096   symbolische Verknüpfung
Device: fd00h/64768d    Inode: 935185      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (65534/ nogroup)
Access: 2014-03-29 09:28:31.812000000 +0100
Modify: 2014-03-29 09:28:31.796000000 +0100
Change: 2014-03-29 09:28:31.796000000 +0100

# /usr/sbin/update-python-modules --post-install
# stat /usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py 
stat: Aufruf von stat für „/usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py“ nicht möglich: Datei oder Verzeichnis nicht gefunden
Comment 2 Philipp Hahn univentionstaff 2014-03-29 09:33:55 CET
FYI: This helped finding the culprit:
# grep -n axf /usr/sbin/update-python-modules 
19:call(("ps", "axf"), stdout=open("/tmp/ps.log", "a"), stdin=open("/dev/null","r"))
Comment 3 Stefan Gohmann univentionstaff 2014-03-29 09:53:06 CET
Good catch!

(In reply to Philipp Hahn from comment #1)
> I can reproduce the bug by doing the following on a new 3.2-1 Generic VM:
> 
> # udm settings/udm_syntax create --set name=Bug34421 --set
> filename=Bug34421.py --set data="$(bzip2
> </usr/share/pyshared/univention/admin/syntax.d/example.py |base64)" --set
> package=bug34421 --set packageversion=34421
> 
> # udm settings/udm_syntax list --position cn=Bug34421,dc=phahn,dc=dev
> DN: cn=Bug34421,dc=phahn,dc=dev
> ARG: None
>   ucsversionstart: None
>   ucsversionend: None
>   name: Bug34421
>   package: bug34421
>   active: TRUE
>   packageversion: 34421
>   data:
> QlpoOTFBWSZTWTX9SDkAAClfgAAwQOQ4EgIADAoqZ89gIAByM/
> UmCNohoPQgxBtJKMmNGkAHqZqGMapeZawdSqXoZnpSIiZoZlqG3Mgum23LKUuB05WRhXGvHvglZFw
> ppXlfg99jUlbFLdDH+ZQtg8NMhmV2jEa4BYMMtf8XckU4UJA1/Ug5
>   filename: Bug34421.py
> 
> # stat /usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py 
>   File: „/usr/lib/pymodules/python2.6/univention/admin/syntax.d/Bug34421.py“
> -> „/usr/share/pyshared/univention/admin/syntax.d/Bug34421.py“
>   Size: 57              Blocks: 0          IO Block: 4096   symbolische
> Verknüpfung
> Device: fd00h/64768d    Inode: 935185      Links: 1
> Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (65534/ nogroup)
> Access: 2014-03-29 09:28:31.812000000 +0100
> Modify: 2014-03-29 09:28:31.796000000 +0100
> Change: 2014-03-29 09:28:31.796000000 +0100
> 

We should add this is in a new test case.
Comment 4 Arvid Requate univentionstaff 2014-04-01 20:43:10 CEST
Ok, the listener module udm_extension.py now creates a ".public" pysupport file for each module/hook/syntax. The objectclass is used as a prefix for the filename. Then update-python-modules -p is used to generate the pymodules links.

The run of 
 ucs-test -e udm-extensions -E dangerous
was successful.

Advisory: 2014-03-25-univention-directory-manager-modules.yaml

Testcase yet to be done.
Comment 5 Arvid Requate univentionstaff 2014-04-02 13:50:09 CEST
Test case: 72_udm-extensions/43_test_update-python-modules
Comment 6 Stefan Gohmann univentionstaff 2014-04-08 12:20:17 CEST
As discussed, the usage of update-python-modules will break the existing modules which have been registered before.
Comment 7 Arvid Requate univentionstaff 2014-04-08 15:13:58 CEST
Ok, the python-univenton-directory-manager postinst now calls "univenton-directory-listener-ctrl resync udm_extension" as part of this update.
Comment 8 Stefan Gohmann univentionstaff 2014-04-15 15:01:01 CEST
OK, looks good.

The test case failed with the old version and succeed with the new version.

YAML: OK
Comment 9 Philipp Hahn univentionstaff 2014-04-15 18:39:44 CEST
*** Bug 34558 has been marked as a duplicate of this bug. ***
Comment 10 Moritz Muehlenhoff univentionstaff 2014-04-22 11:05:51 CEST
http://errata.univention.de/ucs/3.2/97.html