Skip to content

Commit

Permalink
Fix -i tag with --image-is-bundle-check flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpect committed Aug 11, 2023
1 parent dce4d45 commit d3faea0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions pkg/imgpkg/cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ func (po *PullOptions) Run() error {
} else {
return fmt.Errorf("Expected bundle flag when pulling a bundle (hint: Use -b instead of -i for bundles)")
}
} else if pullOpts.IsBundle && errors.Is(err, &v1.ErrIsNotBundle{}) {
return fmt.Errorf("Expected bundle image but found plain image (hint: Did you use -i instead of -b?)")
} else if errors.Is(err, &v1.ErrIsNotBundle{}) {
if pullOpts.IsBundle {
return fmt.Errorf("Expected bundle image but found plain image (hint: Did you use -i instead of -b?)")
} else {
if po.ImageIsBundleCheck {
return fmt.Errorf("Expected correct flag with bundle image (hint: Use --image-is-bundle-check=false instead of --image-is-bundle-check=true for images)")
}
}
}

return err
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/imgpkg/v1/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ func PullWithRegistry(imageRef string, outputPath string, pullOptions PullOpts,
case !isBundle && pullOptions.IsBundle: // Trying to pull an Image as a Bundle
return PullStatus{}, &ErrIsNotBundle{}

case !isBundle && !pullOptions.IsBundle: // Trying to pull an OCI Image
case !isBundle && !pullOptions.IsBundle && !pullOptions.AsImage: // Trying to pull an OCI Image
return PullStatus{}, &ErrIsBundle{}

case !isBundle && !pullOptions.IsBundle && pullOptions.AsImage: // Trying to pull an OCI Image
return pullImage(imageRef, outputPath, pullOptions, reg)

case isBundle && !pullOptions.IsBundle: // Trying to pull a Bundle as if it where an OCI Image
Expand Down

0 comments on commit d3faea0

Please sign in to comment.