1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00
Kevin Kuehler 50dfca2eaf import: Only keep RO copy if ETag header is set
We fix the case when the webserver servers container images without
setting the ETag header in the response.  When an image is downloaded to
image root, a read only copy is stored alongside it.  The filename has
the following form:
    .raw-<encoded-url-of-image>.\x22<ETAG-header>\22.raw.
This is so, if the same resource is fetched multiple times, importd can
avoid extra downloads by creating the new image using the local read-only copy.

The current code assumes the ETag header is set because, if the server
does not set the ETag header, the file is stored without the ETag value
in the filename. When importd fetches a duplicate image, it will run
rename_noreplace and fail:

  Failed to rename raw file to /var/lib/machines/.raw-http:\x2f\x2flocalhost:8000\x2fwalkthroughd.raw: File exists

This patch makes importd only store a read-only image if the webserver
has set the ETag header.
2020-03-23 21:39:59 -07:00
..
2020-03-09 14:58:25 +01:00
2020-03-12 19:55:10 +09:00
2020-02-06 09:52:39 +01:00
2020-01-23 23:38:20 +01:00
2020-01-10 10:06:09 +01:00
2019-11-28 11:41:24 +01:00
2019-10-31 17:57:03 +09:00
2020-02-06 23:49:32 +09:00