diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-18 13:32:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-18 13:32:54 +0100 |
commit | e738ef16225395f5f5e4b93ba1a43ae9449ae11b (patch) | |
tree | 00c7d016a064a6efdf96d7fbcf5deb5e56ddf9ee /cmd/podman/search.go | |
parent | f2139a651706b10824a1641a360020d932798827 (diff) | |
parent | b75dcd445848abad89e19f78193046a8de86c641 (diff) | |
download | podman-e738ef16225395f5f5e4b93ba1a43ae9449ae11b.tar.gz podman-e738ef16225395f5f5e4b93ba1a43ae9449ae11b.tar.bz2 podman-e738ef16225395f5f5e4b93ba1a43ae9449ae11b.zip |
Merge pull request #2354 from rhatdan/varlink
Add registry name to fields returned by varlink image search
Diffstat (limited to 'cmd/podman/search.go')
-rw-r--r-- | cmd/podman/search.go | 16 |
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 -} |