Skip to content

Commit

Permalink
Fix issue 544
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpect committed Aug 11, 2023
1 parent 1a02bc4 commit dce4d45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/imgpkg/cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ func (po *PullOptions) Run() error {
}

if errors.Is(err, &v1.ErrIsBundle{}) {
if len(po.ImageFlags.Image) == 0 {
if pullOpts.IsBundle {
if po.ImageIsBundleCheck {
return fmt.Errorf("Expected bundle flag when pulling a bundle (hint: Use -b instead of -i for bundles)")
} else {
return fmt.Errorf("Expected image flag when wanting to pull a bundle as OCI image (hint: Use -i instead of -b)")
}
} else {
return fmt.Errorf("Expected bundle flag when pulling a bundle (hint: Use -b instead of -i for bundles)")
}
} else if len(po.ImageFlags.Image) == 0 && errors.Is(err, &v1.ErrIsNotBundle{}) {
} 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?)")
}

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 @@ -102,7 +102,10 @@ func PullWithRegistry(imageRef string, outputPath string, pullOptions PullOpts,
}

switch {
case isBundle && pullOptions.AsImage: // Trying to pull the OCI Image of a Bundle
case isBundle && pullOptions.AsImage && pullOptions.IsBundle: // Trying to pull a Bundle as an OCI Image with flag -b
return PullStatus{}, &ErrIsBundle{}

case isBundle && pullOptions.AsImage && !pullOptions.IsBundle: // Trying to pull the OCI Image of a Bundle with flag i
st, err := pullImage(imageRef, outputPath, pullOptions, reg)
if err != nil {
return PullStatus{}, err
Expand Down

0 comments on commit dce4d45

Please sign in to comment.