Bug 43556 - UMC AppCenter uses univention.uldap instead of univention.admin.uldap
UMC AppCenter uses univention.uldap instead of univention.admin.uldap
Status: NEW
Product: UCS Test
Classification: Unclassified
Component: App Center
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: App Center maintainers
:
Depends on: 43550
Blocks:
  Show dependency treegraph
 
Reported: 2017-02-16 06:44 CET by Stefan Gohmann
Modified: 2017-09-14 08:05 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Development Internal
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):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2017-02-16 06:44:08 CET
We should check why our tests didn't find the regression.

+++ This bug was initially created as a clone of Bug #43550 +++

Affected/Broken since: Bug #43423 because UDM now finds the superordinate for the app automatically and then some consistency checks are done.

In svn r61838, r62115 one sees that the appcenter passes the wrong class since a long time. But why?

Version: 4.1-4 errata396 (Vahr)

Remark: install kopano webapp

Execution of command 'appcenter/invoke_dry_run' has failed:

Traceback (most recent call last):
  File "%PY2.7%/univention/management/console/base.py", line 281, in execute
    function(self, request)
  File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 341, in invoke_dry_run
    self.invoke(request)
  File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 129, in _deferred
    return func(self, *args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 656, in _decorated
    return function(self, request, *args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 190, in _response
    return function(self, request)
  File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 515, in invoke
    forbidden, warnings = application.check_invokation(function, self.package_manager)
  File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1244, in check_invokation
    return _check(True), _check(False)
  File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1240, in _check
    reason = method(**kwargs)
  File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1169, in must_have_no_unmet_dependencies
    app = app.to_dict(package_manager, domainwide_managed=True)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 648, in wrapper
    return func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1009, in to_dict
    res['installations'] = self.get_installations(hosts)
  File "%PY2.7%/univention/management/console/ldap.py", line 141, in _decorated
    result = func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 961, in get_installations
    app_objs = appcenter_udm_module.lookup(None, lo, None, base=self.ldap_container)
  File "%PY2.7%/univention/admin/handlers/appcenter/app.py", line 391, in lookup
    res.append(object(co, lo, None, dn, attributes=attrs))
  File "%PY2.7%/univention/admin/handlers/appcenter/app.py", line 362, in __init__
    univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes=attributes)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 592, in __init__
    self._validate_superordinate()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 622, in _validate_superordinate
    if self.dn and not self._ensure_dn_in_subtree(self.superordinate.dn, self.lo.parentDn(self.dn)):
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 627, in _ensure_dn_in_subtree
    if self.lo.lo.compare_dn(dn, parent):
  File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 136, in __getattr__
    self.__class__.__name__,repr(name)
AttributeError: ReconnectLDAPObject has no attribute 'compare_dn'
Comment 1 Florian Best univentionstaff 2017-02-16 11:02:51 CET
> Execution of command 'appcenter/invoke_dry_run' has failed:
> 
> Traceback (most recent call last):
>   File "%PY2.7%/univention/management/console/base.py", line 281, in execute
>     function(self, request)
>   File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 341, in invoke_dry_run
>     self.invoke(request)
>   File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 129, in _deferred
>     return func(self, *args, **kwargs)
>   File "%PY2.7%/univention/management/console/modules/decorators.py", line 656, in _decorated
>     return function(self, request, *args, **kwargs)
>   File "%PY2.7%/univention/management/console/modules/decorators.py", line 190, in _response
>     return function(self, request)
until here everything is boring…

>   File "%PY2.7%/univention/management/console/modules/appcenter/__init__.py", line 515, in invoke
>     forbidden, warnings = application.check_invokation(function, self.package_manager)
>   File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1244, in check_invokation
>     return _check(True), _check(False)
>   File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1240, in _check
>     reason = method(**kwargs)
The appcenter does a dry run and checks all requirements for this action…

>   File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1169, in must_have_no_unmet_dependencies
>     app = app.to_dict(package_manager, domainwide_managed=True)
This is one of the cases where it can raise. The reason is that the app has "requiredappsindomain" set AND there is one of these apps already installed.
>   File "%PY2.7%/univention/management/console/modules/decorators.py", line 648, in wrapper
>     return func(*args, **kwargs)
>   File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 1009, in to_dict
>     res['installations'] = self.get_installations(hosts)
This is required, too to trigger this bug: There must be:
* global/domainwide appcenter must be enabled (self.domainwide_manage())
* more than one host(DC-Master,DC-Backup,DC Slave,Memberserver) in the domain. (utils.get_all_hosts())
>   File "%PY2.7%/univention/management/console/ldap.py", line 141, in _decorated
>     result = func(*args, **kwargs)
>   File "%PY2.7%/univention/management/console/modules/appcenter/app_center.py", line 961, in get_installations
>     app_objs = appcenter_udm_module.lookup(None, lo, None, base=self.ldap_container)
Everything below here( / appcenter_udm_module.lookup() called with wrong uldap instance) will trigger the exception.
>   File "%PY2.7%/univention/admin/handlers/appcenter/app.py", line 391, in lookup
>     res.append(object(co, lo, None, dn, attributes=attrs))
>   File "%PY2.7%/univention/admin/handlers/appcenter/app.py", line 362, in __init__
>     univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes=attributes)
>   File "%PY2.7%/univention/admin/handlers/__init__.py", line 592, in __init__
>     self._validate_superordinate()
>   File "%PY2.7%/univention/admin/handlers/__init__.py", line 622, in _validate_superordinate
>     if self.dn and not self._ensure_dn_in_subtree(self.superordinate.dn, self.lo.parentDn(self.dn)):
>   File "%PY2.7%/univention/admin/handlers/__init__.py", line 627, in _ensure_dn_in_subtree
>     if self.lo.lo.compare_dn(dn, parent):
>   File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 136, in __getattr__
>     self.__class__.__name__,repr(name)
> AttributeError: ReconnectLDAPObject has no attribute 'compare_dn'
Comment 2 Erik Damrose univentionstaff 2017-02-16 11:07:51 CET
(In reply to Florian Best from comment #1)
> >     res['installations'] = self.get_installations(hosts)
> This is required, too to trigger this bug: There must be:
> * global/domainwide appcenter must be enabled (self.domainwide_manage())
> * more than one host(DC-Master,DC-Backup,DC Slave,Memberserver) in the
> domain. (utils.get_all_hosts())

When i reproduced it, the domain had only one server
Comment 3 Florian Best univentionstaff 2017-02-16 11:57:06 CET
(In reply to Erik Damrose from comment #2)
> (In reply to Florian Best from comment #1)
> > >     res['installations'] = self.get_installations(hosts)
> > This is required, too to trigger this bug: There must be:
> > * global/domainwide appcenter must be enabled (self.domainwide_manage())
> > * more than one host(DC-Master,DC-Backup,DC Slave,Memberserver) in the
> > domain. (utils.get_all_hosts())
> 
> When i reproduced it, the domain had only one server
Yes, there may be other code branches which don't require this. I analyzed only this specific traceback, I guess you had a similar but different one.
Comment 4 Dirk Wiesenthal univentionstaff 2017-02-16 12:01:32 CET
Yes, this traceback is exactly for Non-Docker Apps with RequiredAppsInDomain installed via UMC. No more prerequisites:

def must_have_no_unmet_dependencies(self, package_manager):
  ...
  app = app.to_dict(package_manager, domainwide_managed=True)


So domainwide_managed is overwritten (disregarding number of hosts and UCR). The problem is:

  appcenter_udm_module.lookup(None, lo, None, base=self.ldap_container)
("lo" is / was the short coming univention.uldap connection)

coming from
  self.get_installations(hosts)
  self.to_dict(self, package_manager, domainwide_managed=None, hosts=None)

to_dict() is only called in must_have_no_unmet_dependencies (and must_not_be_depended_on - a related test, but run before uninstalling). It used to be the method to send Application's data to UMC frontend, but it has been replaced by the new lib, which does not suffer from this bug.

Now it is only called in two pre-invocation tests.

Cannot be tested with univention-app (new code!) or univention-add-app (does no pre-install checks!). Needs to be UMC.

Affected Apps:
[App(id="kopano-webapp", version="3.2.0.335-19.1"),
 App(id="opsi-local-image", version="4.0.6"),
 App(id="sep-sesam-cli", version="4.4.3-22"),
 App(id="zarafa-webapp", version="2.2.1.43")]