radicale: Log errors during upgrade

Avoid raising errors which could cause endless loop of setup process
failing.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2019-02-09 13:39:59 -05:00 committed by Sunil Mohan Adapa
parent 97f603e998
commit 11e86cf8f8
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -18,6 +18,7 @@
FreedomBox app for radicale. FreedomBox app for radicale.
""" """
import logging
import subprocess import subprocess
from distutils.version import LooseVersion as LV from distutils.version import LooseVersion as LV
@ -60,6 +61,8 @@ reserved_usernames = ['radicale']
manual_page = 'Radicale' manual_page = 'Radicale'
logger = logging.getLogger(__name__)
CONFIG_FILE = '/etc/radicale/config' CONFIG_FILE = '/etc/radicale/config'
VERSION_2 = LV('2') VERSION_2 = LV('2')
@ -90,7 +93,7 @@ def setup(helper, old_version=None):
cache = Cache() cache = Cache()
candidate = cache['radicale'].candidate candidate = cache['radicale'].candidate
if candidate < '2': if candidate < '2':
raise RuntimeError('Radicale 2.x is not available to install.') logger.error('Radicale 2.x is not available to install.')
# Try to upgrade radicale 1.x to 2.x. # Try to upgrade radicale 1.x to 2.x.
helper.call('pre', actions.superuser_run, 'radicale', ['migrate']) helper.call('pre', actions.superuser_run, 'radicale', ['migrate'])
@ -99,10 +102,9 @@ def setup(helper, old_version=None):
# Check that radicale 2.x is installed. # Check that radicale 2.x is installed.
current_version = get_package_version() current_version = get_package_version()
if not current_version: if not current_version:
raise RuntimeError( logger.error('Could not determine installed version of radicale.')
'Could not determine installed version of radicale.')
elif current_version < VERSION_2: elif current_version < VERSION_2:
raise RuntimeError('Could not install radicale 2.x.') logger.error('Could not install radicale 2.x.')
# Enable radicale. # Enable radicale.
helper.call('post', actions.superuser_run, 'radicale', ['setup']) helper.call('post', actions.superuser_run, 'radicale', ['setup'])