Commit graph

6 commits

Author SHA1 Message Date
Michael Vogt
82f2414637 sources: tweak ContainersStorageSources.exists to return False
When an images does not exist just return `False` instead of
raising a RuntimeError. If anything else goes wrong (unknown
output or hash mismatch) keep the RuntimeError as this is an
unexpected exception.
2024-02-27 15:07:42 +01:00
Michael Vogt
0ac05ecb55 sources: tweak docstring for containers-storage 2024-02-27 15:07:42 +01:00
Tomáš Hozza
2b868fbe75 Sources/containers-storage: make the code Python 3.6 compliant
The source implementation used `subprocess.run()` argument
`capture_output`, which was added in Python 3.7. Since the minimum
supported Python version for osbuild on RHEL-8 is 3.6, the stage fails
with TypeError.

Example failure: https://artifacts.dev.testing-farm.io/c147b608-c40e-46ed-bf11-6b15ecf718dc/

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-02-25 09:27:23 +01:00
Achilleas Koutsou
6572b1b8e7 util: remove storage_conf arg from get_host_storage()
Let the caller decide if a reload of the storage configuration is needed
and simplify the storage configuration reader.
2024-02-21 17:55:37 +01:00
Achilleas Koutsou
ac45c292e4 sources/containers-storage: call exists() when fetch()ing
Implement fetch_all() and fetch_one() as calls to exists() to make sure
we check that the containers are available every time they are needed.
2024-02-21 17:55:37 +01:00
Achilleas Koutsou
45510aeb64 sources: new source: containers-storage
This source checks for the existence of a local container in the host's
containers-storage. The source first reads the host's
`/etc/containers/storage.conf` file for the storage config and then
checks if the user has imported the desired container into the local
store.

Unlike the org.osbuild.containers stource, the
org.osbuild.containers-storage source doesn't need any extra data other
than the image ID.  The ID is all that is used to retrieve the
container.  The location and other information regarding the storage are
read from the host configuration and are not encoded in the manifest
There's no need to use the name to resolve it like we do in other
sources because containers in the local storage can be directly
referenced by their image id (config digest).

Other data such as the name of the container will only be relevant in
the stage that will use the container as input.

The source items are objects instead of simple strings of checksums
because we might, in the future, want to add specific options for each
source.

The content_type for this source is `containers-storage`, which defines
the location in the store where the source will bind mount the host's
container storage for stages to read.  We make this different from the
containers content because it will be treated differently enough to need
a separate input type.

Co-authored-by: Gianluca Zuccarelli <gzuccare@redhat.com>
Co-Authored-By: Michael Vogt <michael.vogt@gmail.com>
2024-02-21 17:55:37 +01:00