Bug 44542

Summary: Fix occurrences of using deprecated AppManager and Application
Product: UCS Reporter: Erik Damrose <damrose>
Component: App CenterAssignee: Dirk Wiesenthal <wiesenthal>
Status: CLOSED FIXED QA Contact: Felix Botner <botner>
Severity: major    
Priority: P5 CC: wiesenthal
Version: UCS 4.2   
Target Milestone: UCS 4.3-0-errata   
Hardware: Other   
OS: Linux   
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?: 3: Will affect average number of 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.103 Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional): API change, Cleanup, Error handling
Max CVSS v3 score:
Bug Depends on: 47072    
Bug Blocks:    

Description Erik Damrose univentionstaff 2017-05-05 11:58: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.
Comment 1 Erik Damrose univentionstaff 2017-05-10 10:25:20 CEST
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')]
Comment 2 Dirk Wiesenthal univentionstaff 2018-05-24 15:56:35 CEST
Fixed in
  univention-appcenter 7.0.1-48A~4.3.0.201805241546
and
  ucs-test 8.0.28-127A~4.3.0.201805241548
Comment 3 Felix Botner univentionstaff 2018-05-28 15:08:12 CEST
OK
Comment 4 Erik Damrose univentionstaff 2018-06-06 16:16:20 CEST
<http://errata.software-univention.de/ucs/4.3/91.html>