From f3043cde88d04bc4c33d2c0f50e27b5e69262910 Mon Sep 17 00:00:00 2001 From: Maciej Borzecki Date: Tue, 6 Feb 2024 11:42:54 +0100 Subject: [PATCH] console_conf/core: use a common project for console-conf related apps Make sure that console-conf related apps use the same value for project, which results in using the same shared state directory. Signed-off-by: Maciej Borzecki --- console_conf/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/console_conf/core.py b/console_conf/core.py index 36e4aee4..c9b4585b 100644 --- a/console_conf/core.py +++ b/console_conf/core.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import logging +import os from console_conf.models.console_conf import ConsoleConfModel from console_conf.models.systems import RecoverySystemsModel @@ -22,11 +23,17 @@ from subiquitycore.tui import TuiApplication log = logging.getLogger("console_conf.core") +# project is used to build the state directory path under /run/, which usually +# ends up as /run/console-conf. Note this should only be changed in +# coordination with console-conf-wrapper and any other glue shipped with Ubuntu +# Core boot base +CONSOLE_CONF_PROJECT = os.getenv("SNAP_INSTANCE_NAME", "console-conf") + class ConsoleConf(TuiApplication): from console_conf import controllers as controllers_mod - project = "console-conf" + project = CONSOLE_CONF_PROJECT make_model = ConsoleConfModel @@ -44,7 +51,7 @@ class ConsoleConf(TuiApplication): class RecoveryChooser(TuiApplication): from console_conf import controllers as controllers_mod - project = "console-conf" + project = CONSOLE_CONF_PROJECT controllers = [ "RecoveryChooserWelcome",