Bug 52852 - Traceback when using App Center once App ini file with install permissions is present in cache
Summary: Traceback when using App Center once App ini file with install permissions is...
Status: CLOSED FIXED
Alias: None
Product: UCS
Classification: Unclassified
Component: App Center
Version: UCS 4.4
Hardware: Other Linux
: P5 normal
Target Milestone: UCS 4.4-7-errata
Assignee: Erik Damrose
QA Contact: Felix Botner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-25 19:50 CET by Erik Damrose
Modified: 2021-03-10 15:25 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.160
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Regression
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2021-02-25 19:50:36 CET
The (error-)handling of https responses from docker registries is broken. We detect apps with install permissions, and display the permission to install those apps based on http responses from the docker registry.

If a UCS system has no permission to install the App, the docker registry returns http 401 (Unauthorized).

An App ini file with install permissions must be present in the local app center cache to trigger the traceback (i.e. INI Attribute InstallPermissions=true and ShopURL is set)

The App Center tries to access the docker registries mentioned in the App ini file and requests the image registry manifest in
univention-appcenter/python/appcenter-docker/docker.py:access()

Any exception that is thrown by the urlopen() request causes a traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/__init__.py", line 226, in call_with_namespace
    result = self.main(namespace)
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/list_apps.py", line 61, in main
    for app, versions, installations in self._list(args.app):
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/list_apps.py", line 134, in _list
    for app in self.get_apps():
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/actions/list_apps.py", line 102, in get_apps
    install_permissions = app.install_permissions_exist()
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/app.py", line 995, in install_permissions_exist
    self._install_permissions_exist = access(image)
  File "/usr/lib/python2.7/dist-packages/univention/appcenter/docker.py", line 99, in access
    except urllib_request.HTTPError as exc:
AttributeError: 'Module_six_moves_urllib_request' object has no attribute 'HTTPError'

This is the case with the UMC request 'appcenter/query' and by calling 'univention-app list' on CLI. The UMC module shows a traceback upon opening and shows no app tiles.

This breaks the App Center UDM module and CLI on server which have univention-appcenter >= 8.0.11-131A~4.4.0.202004151814 installed. It was released on 2020-04-22 as UCS 4.4-4e533

The fix is simple and applied for UCS 5 in baf614a33e9a83f426131faa8587dbb5edbd38fe

But there are many UCS 4 systems in a broken state, if an App with install permissions would be released.

+++ This bug was initially created as a clone of Bug #51101 +++
Comment 1 Nico Gulden univentionstaff 2021-03-02 12:43:27 CET
I could verify the traceback with UCS 4.4-6 and the Test App Center. The App Center UMC module cannot be opened and thus no apps can be installed or updated.

I furthermore tested a patch level upgrade to UCS 4.4-7 via UMC. This worked as expected. I just wanted to make sure that the traceback does not have an effect on App Center checks during patch level upgrade.
Comment 3 Erik Damrose univentionstaff 2021-03-04 11:35:23 CET
9059564d Fix traceback when using App Center once App ini file with install permissions is present in cache
c6b19faa yaml

univention-appcenter 8.0.11-146A~4.4.0.202103041132
Comment 4 Felix Botner univentionstaff 2021-03-04 13:43:56 CET
OK - appcenter works with install permissions (univention-app dev-set  bluespice-pro InstallPermissions=true)
OK - yaml