upgrades: Use kvstore and then file to determine if backports are enabled

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-07-22 16:32:39 -04:00
parent 65d8f82ae1
commit d2f6fe9556
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -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():