summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2019-02-15 14:49:12 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2019-02-15 15:30:09 -0500
commitb75dcd445848abad89e19f78193046a8de86c641 (patch)
treed9eec5056be5e240d49286f1d4894aedb252e407 /pkg/varlinkapi/images.go
parent9c1b08fd79012c12d478edb13f6057a0414762db (diff)
downloadpodman-b75dcd445848abad89e19f78193046a8de86c641.tar.gz
podman-b75dcd445848abad89e19f78193046a8de86c641.tar.bz2
podman-b75dcd445848abad89e19f78193046a8de86c641.zip
Add registry name to fields returned by varlink image search
Cockpit team wants to list the registry name where the image was found. Also fix up SearchImages code to check if the user specified a registry in his call to use that rather then all the registries, This matches podman search command. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index b3090d2dd..8deb4cbe2 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -446,9 +446,21 @@ func (i *LibpodAPI) SearchImages(call iopodman.VarlinkCall, query string, limit
if tlsVerify != nil {
sc.DockerInsecureSkipTLSVerify = types.NewOptionalBool(!*tlsVerify)
}
- registries, err := sysreg.GetRegistries()
+ var registries []string
+
+ // Check if search query has a registry in it
+ registry, err := sysreg.GetRegistry(query)
if err != nil {
- return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err))
+ return call.ReplyErrorOccurred(fmt.Sprintf("error getting registry from %q: %q", query, err))
+ }
+ if registry != "" {
+ registries = append(registries, registry)
+ query = query[len(registry)+1:]
+ } else {
+ registries, err = sysreg.GetRegistries()
+ if err != nil {
+ return call.ReplyErrorOccurred(fmt.Sprintf("unable to get system registries: %q", err))
+ }
}
var imageResults []iopodman.ImageSearchResult
for _, reg := range registries {
@@ -468,6 +480,7 @@ func (i *LibpodAPI) SearchImages(call iopodman.VarlinkCall, query string, limit
}
for _, result := range results {
i := iopodman.ImageSearchResult{
+ Registry: reg,
Description: result.Description,
Is_official: result.IsOfficial,
Is_automated: result.IsAutomated,