From 86335aa4ae01dadecd36468409d742e68b76925d Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 14 Dec 2020 11:33:25 -0600 Subject: misc bindings to podman v3 manifest, system, info, volumes, play, and generate bindings are updated to always have binding options. Signed-off-by: baude --- cmd/podman/manifest/push.go | 2 +- cmd/podman/system/prune.go | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/manifest/push.go b/cmd/podman/manifest/push.go index 89faa42a2..96fea4a21 100644 --- a/cmd/podman/manifest/push.go +++ b/cmd/podman/manifest/push.go @@ -107,7 +107,7 @@ func push(cmd *cobra.Command, args []string) error { if cmd.Flags().Changed("tls-verify") { manifestPushOpts.SkipTLSVerify = types.NewOptionalBool(!manifestPushOpts.TLSVerifyCLI) } - if err := registry.ImageEngine().ManifestPush(registry.Context(), args, manifestPushOpts.ManifestPushOptions); err != nil { + if err := registry.ImageEngine().ManifestPush(registry.Context(), args[0], args[1], manifestPushOpts.ManifestPushOptions); err != nil { return err } return nil diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go index 5ee017581..ea47e271f 100644 --- a/cmd/podman/system/prune.go +++ b/cmd/podman/system/prune.go @@ -4,6 +4,7 @@ import ( "bufio" "context" "fmt" + "net/url" "os" "strings" @@ -12,12 +13,13 @@ import ( "github.com/containers/podman/v2/cmd/podman/utils" "github.com/containers/podman/v2/cmd/podman/validate" "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/pkg/errors" "github.com/spf13/cobra" ) var ( - pruneOptions = entities.SystemPruneOptions{} - + pruneOptions = entities.SystemPruneOptions{} + filters []string pruneDescription = fmt.Sprintf(` podman system prune @@ -47,7 +49,7 @@ func init() { flags.BoolVarP(&pruneOptions.All, "all", "a", false, "Remove all unused data") flags.BoolVar(&pruneOptions.Volume, "volumes", false, "Prune volumes") filterFlagName := "filter" - flags.StringArrayVar(&pruneOptions.Filter, filterFlagName, []string{}, "Provide filter values (e.g. 'label==')") + flags.StringArrayVar(&filters, filterFlagName, []string{}, "Provide filter values (e.g. 'label==')") _ = pruneCommand.RegisterFlagCompletionFunc(filterFlagName, completion.AutocompleteNone) } @@ -77,6 +79,15 @@ Are you sure you want to continue? [y/N] `, volumeString) } } + pruneOptions.ContainerPruneOptions = entities.ContainerPruneOptions{} + for _, f := range filters { + t := strings.SplitN(f, "=", 2) + pruneOptions.ContainerPruneOptions.Filters = make(url.Values) + if len(t) < 2 { + return errors.Errorf("filter input must be in the form of filter=value: %s is invalid", f) + } + pruneOptions.ContainerPruneOptions.Filters.Add(t[0], t[1]) + } // TODO: support for filters in system prune response, err := registry.ContainerEngine().SystemPrune(context.Background(), pruneOptions) if err != nil { @@ -100,7 +111,5 @@ Are you sure you want to continue? [y/N] `, volumeString) } } // Print Images prune results - utils.PrintImagePruneResults(response.ImagePruneReport, true) - - return nil + return utils.PrintImagePruneResults(response.ImagePruneReport, true) } -- cgit v1.2.3-54-g00ecf