diff --git a/osbuild/util/containers.py b/osbuild/util/containers.py index 2a40b550..efec734b 100644 --- a/osbuild/util/containers.py +++ b/osbuild/util/containers.py @@ -171,7 +171,7 @@ def container_source(image): yield image_name, image_source -def get_host_storage(storage_conf=None): +def get_host_storage(): """ Read the host storage configuration. """ @@ -183,13 +183,12 @@ def get_host_storage(storage_conf=None): import tomli as toml config_paths = ("/etc/containers/storage.conf", "/usr/share/containers/storage.conf") - if not 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 - except FileNotFoundError: - pass + for conf_path in config_paths: + try: + with open(conf_path, "rb") as conf_file: + storage_conf = toml.load(conf_file) + return storage_conf + except FileNotFoundError: + pass raise FileNotFoundError(f"could not find container storage configuration in any of {config_paths}") diff --git a/sources/org.osbuild.containers-storage b/sources/org.osbuild.containers-storage index 358de635..f83eb4fa 100755 --- a/sources/org.osbuild.containers-storage +++ b/sources/org.osbuild.containers-storage @@ -50,7 +50,8 @@ class ContainersStorageSource(sources.SourceService): """ Construct the full image name that references an image with a given checksum in the local storage. """ - conf = containers.get_host_storage(self.storage_conf) + if self.storage_conf is None: + conf = containers.get_host_storage() driver = conf["storage"]["driver"] graphroot = conf["storage"]["graphroot"] runroot = conf["storage"]["runroot"]