From acdcabcbedba93ed60099d4476b3058808313540 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 8 Aug 2019 11:28:24 -0700 Subject: [PATCH] setup: Clarify success log message when force upgrading Currently, in cases of ignoring an upgrade and actually upgrading, the log message says success which is somewhat confusing. Make the force_upgrade() methods in apps return information about ignoring the upgrade and print log message accordingly. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/bind/__init__.py | 1 + plinth/modules/firewall/__init__.py | 5 +++-- plinth/modules/ttrss/__init__.py | 5 +++-- plinth/setup.py | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plinth/modules/bind/__init__.py b/plinth/modules/bind/__init__.py index b8a9112a2..8575fc757 100644 --- a/plinth/modules/bind/__init__.py +++ b/plinth/modules/bind/__init__.py @@ -126,6 +126,7 @@ def setup(helper, old_version=None): def force_upgrade(helper, _packages): """Force upgrade the managed packages to resolve conffile prompt.""" helper.install(managed_packages, force_configuration='old') + return True def diagnose(): diff --git a/plinth/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py index b93694bf1..ab8acf366 100644 --- a/plinth/modules/firewall/__init__.py +++ b/plinth/modules/firewall/__init__.py @@ -79,16 +79,17 @@ def setup(helper, old_version=None): def force_upgrade(helper, packages): """Force upgrade firewalld to resolve conffile prompts.""" if 'firewalld' not in packages: - return + return False # firewalld 0.4.4.6-2 -> 0.6.x package = packages['firewalld'] if Version(package['current_version']) >= Version('0.6') or \ Version(package['new_version']) < Version('0.6'): - return + return False helper.install(['firewalld'], force_configuration='new') _run(['setup'], superuser=True) + return True def get_enabled_status(): diff --git a/plinth/modules/ttrss/__init__.py b/plinth/modules/ttrss/__init__.py index 3b6d747c6..bf3f97615 100644 --- a/plinth/modules/ttrss/__init__.py +++ b/plinth/modules/ttrss/__init__.py @@ -123,16 +123,17 @@ def setup(helper, old_version=None): def force_upgrade(helper, packages): """Force update package to resolve conffile prompts.""" if 'tt-rss' not in packages: - return + return False # tt-rss 17.4 -> 18.12 package = packages['tt-rss'] if Version(package['current_version']) >= Version('18.12') or \ Version(package['new_version']) < Version('18.12'): - return + return False helper.install(['tt-rss'], force_configuration='new') actions.superuser_run('ttrss', ['setup']) + return True def diagnose(): diff --git a/plinth/setup.py b/plinth/setup.py index 76beaa3c6..8118819ba 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -508,8 +508,11 @@ class ForceUpgrader(): for app, packages in apps.items(): try: logger.info('Force upgrading app: %s', app.name) - app.force_upgrade(app.setup_helper, packages) - logger.info('Successfully force upgraded app: %s', app.name) + if app.force_upgrade(app.setup_helper, packages): + logger.info('Successfully force upgraded app: %s', + app.name) + else: + logger.info('Ignored force upgrade for app: %s', app.name) except Exception as exception: logger.exception('Error running force upgrade: %s', exception) need_retry = True