util: replace toml imports with our util module
This commit is contained in:
parent
292d4ad0fe
commit
bce908e4a2
1 changed files with 2 additions and 7 deletions
|
|
@ -188,17 +188,12 @@ def get_host_storage():
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
# importing this at the top level will break the buildroot
|
# importing this at the top level will break the buildroot
|
||||||
try:
|
from osbuild.util import toml
|
||||||
import tomllib as toml
|
|
||||||
except ImportError:
|
|
||||||
import tomli as toml
|
|
||||||
|
|
||||||
config_paths = ("/etc/containers/storage.conf", "/usr/share/containers/storage.conf")
|
config_paths = ("/etc/containers/storage.conf", "/usr/share/containers/storage.conf")
|
||||||
for conf_path in config_paths:
|
for conf_path in config_paths:
|
||||||
try:
|
try:
|
||||||
with open(conf_path, "rb") as conf_file:
|
return toml.load_from_file(conf_path)
|
||||||
storage_conf = toml.load(conf_file)
|
|
||||||
return storage_conf
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue