summaryrefslogtreecommitdiff
path: root/cmd/podman/search.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 /cmd/podman/search.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 'cmd/podman/search.go')
-rw-r--r--cmd/podman/search.go16
1 files changed, 1 insertions, 15 deletions
diff --git a/cmd/podman/search.go b/cmd/podman/search.go
index 2febee689..858addff6 100644
--- a/cmd/podman/search.go
+++ b/cmd/podman/search.go
@@ -12,7 +12,6 @@ import (
"github.com/containers/libpod/cmd/podman/formats"
"github.com/containers/libpod/libpod/common"
sysreg "github.com/containers/libpod/pkg/registries"
- "github.com/docker/distribution/reference"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@@ -88,7 +87,7 @@ func searchCmd(c *cliconfig.SearchValues) error {
term := args[0]
// Check if search term has a registry in it
- registry, err := getRegistry(term)
+ registry, err := sysreg.GetRegistry(term)
if err != nil {
return errors.Wrapf(err, "error getting registry from %q", term)
}
@@ -301,16 +300,3 @@ func matchesOfficialFilter(filter searchFilterParams, result docker.SearchResult
}
return true
}
-
-func getRegistry(image string) (string, error) {
- // It is possible to only have the registry name in the format "myregistry/"
- // if so, just trim the "/" from the end and return the registry name
- if strings.HasSuffix(image, "/") {
- return strings.TrimSuffix(image, "/"), nil
- }
- imgRef, err := reference.Parse(image)
- if err != nil {
- return "", err
- }
- return reference.Domain(imgRef.(reference.Named)), nil
-}