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 955dc6f commit 2e77424
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 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 All @@ -259,10 +263,6 @@ func GetDiffer(ctx context.Context, store storage.Store, blobDigest digest.Diges
}

func makeConvertFromRawDiffer(ctx context.Context, store storage.Store, blobDigest digest.Digest, blobSize int64, annotations map[string]string, iss ImageSourceSeekable, storeOpts *types.StoreOptions) (*chunkedDiffer, error) {
if !parseBooleanPullOption(storeOpts, "convert_images", false) {
return nil, errors.New("convert_images not configured")
}

layersCache, err := getLayersCache(store)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1701,10 +1701,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 2e77424

Please sign in to comment.