From bce908e4a2b7e50bbabb442e2c7f596f466e9b4a Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Thu, 15 Aug 2024 14:17:25 +0200 Subject: [PATCH] util: replace toml imports with our util module --- osbuild/util/containers.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osbuild/util/containers.py b/osbuild/util/containers.py index 6f6a76d0..dcf061df 100644 --- a/osbuild/util/containers.py +++ b/osbuild/util/containers.py @@ -188,17 +188,12 @@ def get_host_storage(): """ # pylint: disable=import-outside-toplevel # importing this at the top level will break the buildroot - try: - import tomllib as toml - except ImportError: - import tomli as toml + from osbuild.util import toml config_paths = ("/etc/containers/storage.conf", "/usr/share/containers/storage.conf") for conf_path in config_paths: try: - with open(conf_path, "rb") as conf_file: - storage_conf = toml.load(conf_file) - return storage_conf + return toml.load_from_file(conf_path) except FileNotFoundError: pass