Skip to content

Commit

Permalink
storage: move check for enable_partial_images to GetDiffer
Browse files Browse the repository at this point in the history
move the check for `enable_partial_images` to GetDiffer so that it
doesn't attempt any operation if the feature is disabled.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Feb 15, 2024
1 parent 23ff5f8 commit 8c1cf34
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/chunked/storage_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ func GetDiffer(ctx context.Context, store storage.Store, blobDigest digest.Diges
return nil, err
}

if !parseBooleanPullOption(&storeOpts, "enable_partial_images", true) {
return nil, errors.New("enable_partial_images not configured")
}

_, hasZstdChunkedTOC := annotations[internal.ManifestChecksumKey]
_, hasEstargzTOC := annotations[estargz.TOCJSONDigestAnnotation]

Expand Down Expand Up @@ -1701,10 +1705,6 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
UncompressedDigest: uncompressedDigest,
}

if !parseBooleanPullOption(c.storeOpts, "enable_partial_images", true) {
return output, errors.New("enable_partial_images not configured")
}

// When the hard links deduplication is used, file attributes are ignored because setting them
// modifies the source file as well.
useHardLinks := parseBooleanPullOption(c.storeOpts, "use_hard_links", false)
Expand Down

0 comments on commit 8c1cf34

Please sign in to comment.