Univention Bugzilla – Bug 44542
Fix occurrences of using deprecated AppManager and Application
Last modified: 2018-06-06 16:16:20 CEST
univention-appcenter/python/appcenter/app.py:1510 # LEGACY; deprecated, use univention.appcenter.app_cache.Apps()! class AppManager(object): The issue is, that calling some AppManager methods now silently returns None instead of throwing an error, and they no longer return the expected result. After fixing several issues where the class was used in the UCS appliance generation, i checked the svn: There are several AppManager users in UCS 4.2... dev/branches/ucs-4.2/ucs-4.2-0$ rgrep AppManager test/ucs-test/tests/20_appcenter/75_umc_query_app_data:from univention.appcenter import AppManager test/ucs-test/tests/20_appcenter/75_umc_query_app_data: AppManager.clear_cache() test/ucs-test/tests/20_appcenter/75_umc_query_app_data: AppManager.clear_cache() base/univention-updater/script/preup.sh:from univention.appcenter.app import AppManager base/univention-updater/script/preup.sh:for app in AppManager.get_all_locally_installed_apps(): base/univention-updater/python/univention-upgrade: from univention.appcenter.app import AppManager base/univention-updater/python/univention-upgrade: newer_app = AppManager.find_candidate(app) management/univention-appcenter/python/appcenter/__init__.py:from univention.appcenter.app import App, AppManager management/univention-appcenter/python/appcenter/__init__.py:__all__ = ('App', 'AppManager', 'get_action', 'all_actions') management/univention-appcenter/python/appcenter-docker/actions/docker_remove.py:from univention.appcenter.app import AppManager management/univention-appcenter/python/appcenter-docker/actions/docker_remove.py: for _app in AppManager.get_all_apps(): I think we should fix all occurrences, because calling some AppManager methods will not fail but silently return None. This changes the behavior of the code.
I also found that from univention.management.console.modules.appcenter.app_center import Application Application.find(APPID) does not find UCS 4.1 docker apps on a UCS 4.2. A quick grep show that is still used in test/ucs-test/tests/20_appcenter/31_ini_version_check: App = Application.find(APP_ID) test/ucs-test/tests/20_appcenter/10_check_apps_ini: App = Application.find(app_id) base/univention-updater/script/univention-add-app: app = Application.find(component_id) base/univention-updater/script/univention-add-app: requested_app = Application.find(component_id) base/univention-updater/script/univention-add-app: requested_app.versions = Application.find(requested_app.id).versions management/univention-appcenter/umc/python/appcenter/__init__.py: application = Application.find(application_id) management/univention-appcenter/umc/python/appcenter/util.py: app = Application.find(old_id) management/univention-appcenter/umc/python/appcenter/util.py: app = Application.find(new_id) management/univention-appcenter/umc/python/appcenter/app_center.py: app = Application.find(self.get('plugin_of')) management/univention-appcenter/umc/python/appcenter/app_center.py: apps = [Application.find(app_id) for app_id in self.get('requiredappsindomain')]
Fixed in univention-appcenter 7.0.1-48A~4.3.0.201805241546 and ucs-test 8.0.28-127A~4.3.0.201805241548
OK
<http://errata.software-univention.de/ucs/4.3/91.html>