summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/images/pull.go11
-rw-r--r--cmd/podman/images/search.go27
2 files changed, 22 insertions, 16 deletions
diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go
index f996d0681..fead5f7ed 100644
--- a/cmd/podman/images/pull.go
+++ b/cmd/podman/images/pull.go
@@ -93,23 +93,22 @@ func pullFlags(flags *pflag.FlagSet) {
// imagePull is implement the command for pulling images.
func imagePull(cmd *cobra.Command, args []string) error {
- pullOptsAPI := pullOptions.ImagePullOptions
// 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") {
- pullOptsAPI.TLSVerify = types.NewOptionalBool(pullOptions.TLSVerifyCLI)
+ pullOptions.SkipTLSVerify = types.NewOptionalBool(!pullOptions.TLSVerifyCLI)
}
- if pullOptsAPI.Authfile != "" {
- if _, err := os.Stat(pullOptsAPI.Authfile); err != nil {
- return errors.Wrapf(err, "error getting authfile %s", pullOptsAPI.Authfile)
+ if pullOptions.Authfile != "" {
+ if _, err := os.Stat(pullOptions.Authfile); err != nil {
+ return errors.Wrapf(err, "error getting authfile %s", pullOptions.Authfile)
}
}
// Let's do all the remaining Yoga in the API to prevent us from
// scattering logic across (too) many parts of the code.
- pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), args[0], pullOptsAPI)
+ pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), args[0], pullOptions.ImagePullOptions)
if err != nil {
return err
}
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
}