config: sanity check via types (MR 2252)

Replace the "sanity_check" code with type checking built into the Config
__setattr__ operator.

This keeps all the Config related code in one place.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-09 03:27:45 +02:00 committed by Oliver Smith
parent 7a8deb0f5e
commit 1a01738d50
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 39 additions and 43 deletions

View file

@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.core import get_context
from pmb.core.chroot import Chroot
from pmb.core.config import SystemdConfig
from pmb.core.context import Context
from pmb.core.pkgrepo import pkgrepo_default_path
from pmb.helpers import logging
@ -211,7 +212,7 @@ def ask_for_systemd(config: Config, ui):
logging.info("Based on your UI selection, 'default' will result"
f" in{not_str}installing systemd.")
choices = pmb.config.allowed_values["systemd"]
choices = SystemdConfig.choices()
answer = pmb.helpers.cli.ask("Install systemd?",
choices,
config.systemd,