Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extractZst: allow overwriting image files
There is an issue with the new pull image functionality, where ovewriting an existing file does not work and no errors are generated. $ rm -rf _data/images/kind_rhel8.qcow2{,.zst} $ echo "PIZZA" > _data/images/kind_rhel8.qcow2 $ ~/src/little-vm-helper/lvh images pull --cache quay.io/lvh-images/kind-ci:rhel8-20240201.122048 $ cat _data/images/kind_rhel8.qcow2 PIZZA $ ls _data/images/kind_rhel8.qcow2{,.zst} _data/images/kind_rhel8.qcow2 _data/images/kind_rhel8.qcow2.zst There is a check at extractZst for the existance of the destination file. If the file exists, we erturn os.ErrExist. This error is propagated up to ExtractImage but is turned to a non-error by its caller. This patch adds support for overwriting images. We create a tempfile for the uncompression and if everything goes well, we rename it to the intended destination. Signed-off-by: Kornilios Kourtis <[email protected]>
- Loading branch information