summaryrefslogtreecommitdiff
path: root/cmd/podmanV2/images/pull.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-04-15 10:12:30 -0700
committerJhon Honce <jhonce@redhat.com>2020-04-16 11:08:08 -0700
commit1d93d212541616135da23bcf01ca49180f113e62 (patch)
treee75553459f315d69904d6b1687a1423d0825e219 /cmd/podmanV2/images/pull.go
parent5def21140038fc34cee9707d3069bf52adc24577 (diff)
downloadpodman-1d93d212541616135da23bcf01ca49180f113e62.tar.gz
podman-1d93d212541616135da23bcf01ca49180f113e62.tar.bz2
podman-1d93d212541616135da23bcf01ca49180f113e62.zip
V2 Enable rootless
* Enable running podman V2 rootless * Fixed cobra.PersistentPreRunE usage in all the commands * Leveraged cobra.PersistentPreRunE/cobra.PersistentPostRunE to manage: * rootless * trace (--trace) * profiling (--cpu-profile) * initializing the registry copies of Image/Container engines * Help and Usage templates autoset for all sub-commands Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podmanV2/images/pull.go')
-rw-r--r--cmd/podmanV2/images/pull.go40
1 files changed, 9 insertions, 31 deletions
diff --git a/cmd/podmanV2/images/pull.go b/cmd/podmanV2/images/pull.go
index c7e325409..74090dee4 100644
--- a/cmd/podmanV2/images/pull.go
+++ b/cmd/podmanV2/images/pull.go
@@ -7,8 +7,6 @@ import (
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podmanV2/registry"
"github.com/containers/libpod/pkg/domain/entities"
- "github.com/opentracing/opentracing-go"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -28,11 +26,11 @@ var (
// Command: podman pull
pullCmd = &cobra.Command{
- Use: "pull [flags] IMAGE",
- Short: "Pull an image from a registry",
- Long: pullDescription,
- PreRunE: preRunE,
- RunE: imagePull,
+ Use: "pull [flags] IMAGE",
+ Args: cobra.ExactArgs(1),
+ Short: "Pull an image from a registry",
+ Long: pullDescription,
+ RunE: imagePull,
Example: `podman pull imageName
podman pull fedora:latest`,
}
@@ -41,11 +39,10 @@ var (
// It's basically a clone of `pullCmd` with the exception of being a
// child of the images command.
imagesPullCmd = &cobra.Command{
- Use: pullCmd.Use,
- Short: pullCmd.Short,
- Long: pullCmd.Long,
- PreRunE: pullCmd.PreRunE,
- RunE: pullCmd.RunE,
+ Use: pullCmd.Use,
+ Short: pullCmd.Short,
+ Long: pullCmd.Long,
+ RunE: pullCmd.RunE,
Example: `podman image pull imageName
podman image pull fedora:latest`,
}
@@ -58,9 +55,6 @@ func init() {
Command: pullCmd,
})
- pullCmd.SetHelpTemplate(registry.HelpTemplate())
- pullCmd.SetUsageTemplate(registry.UsageTemplate())
-
flags := pullCmd.Flags()
pullFlags(flags)
@@ -71,8 +65,6 @@ func init() {
Parent: imageCmd,
})
- imagesPullCmd.SetHelpTemplate(registry.HelpTemplate())
- imagesPullCmd.SetUsageTemplate(registry.UsageTemplate())
imagesPullFlags := imagesPullCmd.Flags()
pullFlags(imagesPullFlags)
}
@@ -99,20 +91,6 @@ func pullFlags(flags *pflag.FlagSet) {
// imagePull is implement the command for pulling images.
func imagePull(cmd *cobra.Command, args []string) error {
- // Sanity check input.
- if len(args) == 0 {
- return errors.Errorf("an image name must be specified")
- }
- if len(args) > 1 {
- return errors.Errorf("too many arguments. Requires exactly 1")
- }
-
- // Start tracing if requested.
- if cmd.Flags().Changed("trace") {
- span, _ := opentracing.StartSpanFromContext(registry.GetContext(), "pullCmd")
- defer span.Finish()
- }
-
pullOptsAPI := pullOptions.ImagePullOptions
// TLS verification in c/image is controlled via a `types.OptionalBool`
// which allows for distinguishing among set-true, set-false, unspecified