matrixsynapse: Allow upgrade to 1.8.*

- Use new configuration from package.
- Re-run the post-install to set our custom config.
- Re-apply setting for public registration if enabled.

Tested by manually downgrading matrix-synapse to 1.6.1-1 and then
running apt update.

Fixes #1754.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-01-13 12:18:16 -05:00 committed by Sunil Mohan Adapa
parent 5b399ef2f7
commit f6c7f77c0f
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -33,6 +33,7 @@ from plinth.daemon import Daemon
from plinth.modules.apache.components import Webserver
from plinth.modules.firewall.components import Firewall
from plinth.modules.letsencrypt.components import LetsEncrypt
from plinth.utils import Version
from .manifest import backup, clients # noqa, pylint: disable=unused-import
@ -141,6 +142,26 @@ def setup(helper, old_version=None):
app.get_component('letsencrypt-matrixsynapse').setup_certificates()
def force_upgrade(helper, packages):
"""Force upgrade matrix-synapse to resolve conffile prompt."""
if 'matrix-synapse' not in packages:
return False
# Allow any lower version to upgrade to 1.8.*
package = packages['matrix-synapse']
if Version(package['new_version']) > Version('1.9~'):
return False
public_registration_status = get_public_registration_status()
helper.install(['matrix-synapse'], force_configuration='new')
actions.superuser_run('matrixsynapse', ['post-install'])
if public_registration_status:
actions.superuser_run('matrixsynapse',
['public-registration', 'enable'])
return True
def setup_domain(domain_name):
"""Configure a domain name for matrixsynapse."""
app.get_component('letsencrypt-matrixsynapse').setup_certificates(