diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-29 17:04:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 17:04:22 +0200 |
commit | 27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685 (patch) | |
tree | 20d229709222de49e138b23e5790baf958c56338 /cmd/podman/images/search.go | |
parent | d1196d08d0c931885cf383ff4e568a855e8e4673 (diff) | |
parent | 5ee3af2d03b595bdff004ec179fc8a38e97cc5fe (diff) | |
download | podman-27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685.tar.gz podman-27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685.tar.bz2 podman-27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685.zip |
Merge pull request #6039 from vrothberg/enable-search-tests
Enable search tests
Diffstat (limited to 'cmd/podman/images/search.go')
-rw-r--r-- | cmd/podman/images/search.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go index fdad94d45..a8abfb339 100644 --- a/cmd/podman/images/search.go +++ b/cmd/podman/images/search.go @@ -1,6 +1,7 @@ package images import ( + "os" "reflect" "strings" @@ -47,14 +48,15 @@ var ( // Command: podman image search imageSearchCmd = &cobra.Command{ - Use: searchCmd.Use, - Short: searchCmd.Short, - Long: searchCmd.Long, - RunE: searchCmd.RunE, - Args: searchCmd.Args, + Use: searchCmd.Use, + Short: searchCmd.Short, + Long: searchCmd.Long, + RunE: searchCmd.RunE, + Args: searchCmd.Args, + Annotations: searchCmd.Annotations, Example: `podman image search --filter=is-official --limit 3 alpine - podman image search registry.fedoraproject.org/ # only works with v2 registries - podman image search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`, + podman image search registry.fedoraproject.org/ # only works with v2 registries + podman image search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`, } ) @@ -103,16 +105,21 @@ func imageSearch(cmd *cobra.Command, args []string) error { return errors.Errorf("search requires exactly one argument") } - sarchOptsAPI := searchOptions.ImageSearchOptions // TLS verification in c/image is controlled via a `types.OptionalBool` // which allows for distinguishing among set-true, set-false, unspecified // which is important to implement a sane way of dealing with defaults of // boolean CLI flags. if cmd.Flags().Changed("tls-verify") { - sarchOptsAPI.TLSVerify = types.NewOptionalBool(pullOptions.TLSVerifyCLI) + searchOptions.SkipTLSVerify = types.NewOptionalBool(!searchOptions.TLSVerifyCLI) } - searchReport, err := registry.ImageEngine().Search(registry.GetContext(), searchTerm, sarchOptsAPI) + if searchOptions.Authfile != "" { + if _, err := os.Stat(searchOptions.Authfile); err != nil { + return errors.Wrapf(err, "error getting authfile %s", searchOptions.Authfile) + } + } + + searchReport, err := registry.ImageEngine().Search(registry.GetContext(), searchTerm, searchOptions.ImageSearchOptions) if err != nil { return err } |