[Pkg-mailman-hackers] Bug#924330: postinst function django_config_site() broken

Jonas Meurer jonas at freesources.org
Mon Mar 11 17:19:57 GMT 2019


Package: mailman3-web
Version: 0+20180916-6
Severity: important

Hello,

the postinst function django_config_site() is broken, we need to
rewrite it.

At the moment, it tries to read (and update) the default django site
domain by using `Site.objects.all()[0]`, which seems to be wrong. If at
all, then `Site.objects.last()` seems to be the default django site
domain (i.e. first one that got created), but even that one seems
error-prone.

My impression is, that there is no reliable way for us during upgrade
to determine which django site domain got created by our postinst script
earlier. Therefore I propose the following:

If we do a fresh install (i.e. "$2" is empty) *and* a django site domain
is configured via debconf, we override the default django site domain
(i.e. 'example.com') with the configured one.

If we do an upgrade *and* a django site domain is set via debconf, we
check if a django site domain with the same domain name already exists.
If that's not the case, then we add a new django site domain.

This solution occurs much more robust to me than the current
implementation.

Only downside is, that if the django site domain gets changed in
debconf at a later point, we don't override the old django site domain
but append a new one. I don't think it's a major problem though. And
given that there is no reliable way to determine *which* of the existing
django site domains got created by our postinst script before, I think
it's an acceptable tradeoff.

Cheers
 jonas



More information about the Pkg-mailman-hackers mailing list