summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
authorLars Karlitski <lars@karlitski.net>2019-02-04 20:39:23 +0100
committerLars Karlitski <lars@karlitski.net>2019-02-12 14:48:19 +0100
commit2448129e4d27b95ce172f0ab5ac32c891aae7519 (patch)
treea1476517f5beff8963246363da181a887ac8c7a1 /pkg/varlinkapi/images.go
parent5a325181709041ec01a4e60ed039bbd8cb7a20db (diff)
downloadpodman-2448129e4d27b95ce172f0ab5ac32c891aae7519.tar.gz
podman-2448129e4d27b95ce172f0ab5ac32c891aae7519.tar.bz2
podman-2448129e4d27b95ce172f0ab5ac32c891aae7519.zip
varlink: Rename `SearchImage` to `SearchImages`
Also rename image result struct to `ImageSearchResult` and make `limit` parameter optional. Signed-off-by: Lars Karlitski <lars@karlitski.net>
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index bec3056fe..9dfc9db03 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -399,17 +399,21 @@ func (i *LibpodAPI) RemoveImage(call iopodman.VarlinkCall, name string, force bo
return call.ReplyRemoveImage(newImage.ID())
}
-// SearchImage searches all registries configured in /etc/containers/registries.conf for an image
+// SearchImages searches all registries configured in /etc/containers/registries.conf for an image
// Requires an image name and a search limit as int
-func (i *LibpodAPI) SearchImage(call iopodman.VarlinkCall, name string, limit int64) error {
+func (i *LibpodAPI) SearchImages(call iopodman.VarlinkCall, query string, limit *int64) error {
sc := image.GetSystemContext("", "", false)
registries, err := sysreg.GetRegistries()
if err != nil {
return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err))
}
- var imageResults []iopodman.ImageSearch
+ var imageResults []iopodman.ImageSearchResult
for _, reg := range registries {
- results, err := docker.SearchRegistry(getContext(), sc, reg, name, int(limit))
+ var lim = 1000
+ if limit != nil {
+ lim = int(*limit)
+ }
+ results, err := docker.SearchRegistry(getContext(), sc, reg, query, lim)
if err != nil {
// If we are searching multiple registries, don't make something like an
// auth error fatal. Unfortunately we cannot differentiate between auth
@@ -420,7 +424,7 @@ func (i *LibpodAPI) SearchImage(call iopodman.VarlinkCall, name string, limit in
return call.ReplyErrorOccurred(err.Error())
}
for _, result := range results {
- i := iopodman.ImageSearch{
+ i := iopodman.ImageSearchResult{
Description: result.Description,
Is_official: result.IsOfficial,
Is_automated: result.IsAutomated,
@@ -430,7 +434,7 @@ func (i *LibpodAPI) SearchImage(call iopodman.VarlinkCall, name string, limit in
imageResults = append(imageResults, i)
}
}
- return call.ReplySearchImage(imageResults)
+ return call.ReplySearchImages(imageResults)
}
// DeleteUnusedImages deletes any images that do not have containers associated with it.