Skip to content

Commit

Permalink
fix: oci cache store should fallback to copy when rename won't work (#96
Browse files Browse the repository at this point in the history
)
  • Loading branch information
azenla authored Apr 16, 2024
1 parent 8135307 commit 4e9738b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/oci/src/packer/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ impl OciPackerCache {
fs_path.push(format!("{}.{}", packed.digest, packed.format.extension()));
manifest_path.push(format!("{}.manifest.json", packed.digest));
config_path.push(format!("{}.config.json", packed.digest));
fs::rename(&packed.path, &fs_path).await?;
if fs::rename(&packed.path, &fs_path).await.is_err() {
fs::copy(&packed.path, &fs_path).await?;
fs::remove_file(&packed.path).await?;
}
fs::write(&config_path, packed.config.raw()).await?;
fs::write(&manifest_path, packed.manifest.raw()).await?;
manifests.retain(|item| {
Expand Down

0 comments on commit 4e9738b

Please sign in to comment.