Comment 3 for bug 1773201

Revision history for this message
Steve Langasek (vorlon) wrote :

The upstream diff includes changes to the backwards-compatibility with older versions of django:

--- maas-2.4.0~beta2-6865-gec43e47e6/src/maasserver/djangosettings/monkey.py 2018-04-15 15:08:20.000000000 +0000
+++ maas-2.4.0-6981-g011e51b7a/src/maasserver/djangosettings/monkey.py 2018-05-21 17:19:12.000000000 +0000
@@ -15,9 +15,9 @@
     twisted or any other thread, as it does not get the correct prefix when
     using reverse. This converts the local() into an object that is global.
     """
- try:
- from django.urls import base
- base._prefixes = type('', (), {})()
- except ImportError:
- from django.core import urlresolvers
- urlresolvers._prefixes = type('', (), {})()
+ from django.urls import base
+ unset = object()
+ value = getattr(base._prefixes, 'value', unset)
+ base._prefixes = type('', (), {})()
+ if value is not unset:
+ base._prefixes.value = value

According to https://stackoverflow.com/questions/38944378/django-from-django-urls-import-reverse-importerror-no-module-named-urls this try/except construction is needed for django < 1.10. bionic has django 1.11.11, but xenial had django 1.8. This makes for a regression in the support for partial upgrades from xenial, which while not recommended for deployment, means that the maas service might behave incorrectly in the midst of a release upgrade from xenial to bionic. This should be avoided by making the dependency on python3-django versioned (>= 1:1.10).

There are other changes throughout src/maasserver/djangosettings that look like they also break compatibility with older versions of django; though I haven't investigated to confirm which exact versions they require. A versioned dependency that's > xenial and <= bionic is sufficient to enforce the upgrade ordering.

This is a relatively minor regression but is still a regression, so I am rejecting the current upload. I have reviewed the rest of the upload and would accept it into -proposed with this issue addressed.