util: replace toml imports with our util module

This commit is contained in:
Achilleas Koutsou 2024-08-15 14:17:25 +02:00 committed by Michael Vogt
parent 292d4ad0fe
commit bce908e4a2

View file

@ -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