From d2f6fe955645a3815871460772b42770f4b70c8e Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Wed, 22 Jul 2020 16:32:39 -0400 Subject: [PATCH] upgrades: Use kvstore and then file to determine if backports are enabled Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/modules/upgrades/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index d144f2cd0..ff191aedf 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -139,8 +139,7 @@ def disable(): def setup_repositories(data): """Setup apt backport repositories.""" - from plinth import kvstore - if kvstore.get_default(BACKPORTS_ENABLED_KEY, False): + if is_backports_enabled(): command = ['setup-repositories'] if cfg.develop: command += ['--develop'] @@ -150,7 +149,9 @@ def setup_repositories(data): def is_backports_enabled(): """Return whether backports are enabled.""" - return os.path.exists(SOURCES_LIST) + from plinth import kvstore + return kvstore.get_default(BACKPORTS_ENABLED_KEY, + os.path.exists(SOURCES_LIST)) def get_current_release():