Univention Bugzilla – Bug 34535
base/univention-lib/python/ldap_extension.py # unregister() does not work
Last modified: 2020-06-22 15:33:29 CEST
Created attachment 5869 [details] Start fixing UniventionLDAPExtension.unregister() <http://docs.univention.de/developer-reference-3.2.html#join:libraries:shell> mentions the environment variable UNIVENTION_APP_IDENTIFIER, which should be set. But it does not describe what it is required for. 1. If explicitly given, the information is --set and not --append in all cases, even though it is a multi-valued attribute in base/univention-lib/python/ldap_extension.py. 2. unregister() does a UDM search for the specified object of type settings/udm_module settings/udm_syntax settings/udm_hook settings/ldapacl settings/ldapschema From it the values of the property "appidentifier" are fetched. With that a search for "appcenter/app" is performed to check, if apps using that extension are still installed. This should be described, as not setting an App-ID or setting it wrong might case the extension to be uninstalled (when the tool from Bug #32418 is ready). 3. According to the Schema file, the AppId is stored in the LDAP attribute "univentionAppID" and not in "cn": 279 »···»···»···»···app_filter = app_filter + "(cn=%s)" % appidentifier # univention-ldapsearch -LLLb 'cn=Subschema' -s base objectClasses -o ldif-wrap=no -E 'mv=(objectClasses=1.3.6.1.4.1.10176.4204.2.1)' dn: cn=Subschema objectClasses: ( 1.3.6.1.4.1.10176.4204.2.1 NAME 'univentionApp' DESC 'UCS App Metadata' SUP top STRUCTURAL MUST univentionAppID MAY ( univentionAppName $ univentionAppVersion $ univentionAppDescription $ univentionAppLongDescription $ univentionAppScreenshot $ univentionAppIcon $ univentionAppCategory $ univentionAppVendor $ univentionAppContact $ univentionAppMaintainer $ univentionAppWebsite $ univentionAppWebsiteVendor $ univentionAppWebsiteMaintainer $ univentionAppWebInterface $ univentionAppWebInterfaceName $ univentionAppConflictingApps $ univentionAppConflictingSystemPackages $ univentionAppDefaultPackages $ univentionAppDefaultPackagesMaster $ univentionAppUMCModuleName $ univentionAppUMCModuleFlavor $ univentionAppServerRole $ univentionAppInstalledOnServer ) )
4. the documentation is also wrong: it separates the "appID" and "appVersion" with a '-', while the code uses '_'. I'd recommend to update the documentation, as package-names and version-numbers contain '-' themselves, while _ is already in Debian package file names to separate the package name from the version. # udm appcenter/app list | grep ^DN DN: univentionAppID=samba4_4.1,cn=samba4,cn=apps,cn=univention,dc=phahn,dc=dev DN: univentionAppID=mailserver_8,cn=mailserver,cn=apps,cn=univention,dc=phahn,dc=dev DN: univentionAppID=oxseforucs_7.4.2-6-ucs7,cn=oxseforucs,cn=apps,cn=univention,dc=phahn,dc=dev $ git grep -n UNIVENTION_APP_IDENTIFIER join/join.xml:688: Before calling the shell function the shell variable <envar>UNIVENTION_APP_IDENTIFIER</envar> should be set to the versioned app identifier (and exported to the environment of subprocesses). join/join.xml:712:export UNIVENTION_APP_IDENTIFIER="appID-appVersion" ldap/ldap.xml:120:export UNIVENTION_APP_IDENTIFIER="appID-appVersion" ldap/ldap.xml:220:export UNIVENTION_APP_IDENTIFIER="appID-appVersion"
Probably still broken, although I do not know whether this is ever used in our software. If I recall correctly, there are several sys.exit() in these functions which I consider dangerous for a lib.