Skip to content

Commit

Permalink
Merge pull request #2066 from rhatdan/filter
Browse files Browse the repository at this point in the history
Display same error as split
  • Loading branch information
openshift-merge-bot[bot] committed Jul 17, 2024
2 parents fdf625d + cc398cf commit fdbae3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libimage/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
return tree, nil
}

filterInvalidValue := `invalid image filter %q: must be in the format "filter=value or filter!=value"`

var wantedReferenceMatches, unwantedReferenceMatches []string
filters := map[string][]filterFunc{}
duplicate := map[string]string{}
Expand All @@ -101,7 +103,7 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
} else {
split = strings.SplitN(f, "=", 2)
if len(split) != 2 {
return nil, fmt.Errorf("invalid image filter %q: must be in the format %q", f, "filter=value or filter!=value")
return nil, fmt.Errorf(filterInvalidValue, f)
}
}

Expand Down Expand Up @@ -195,7 +197,7 @@ func (r *Runtime) compileImageFilters(ctx context.Context, options *ListImagesOp
filter = filterBefore(until)

default:
return nil, fmt.Errorf("unsupported image filter %q", key)
return nil, fmt.Errorf(filterInvalidValue, key)
}
if negate {
filter = negateFilter(filter)
Expand Down

0 comments on commit fdbae3a

Please sign in to comment.