diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/create.go | 5 | ||||
-rw-r--r-- | cmd/podman/containers/rm.go | 3 | ||||
-rw-r--r-- | cmd/podman/images/scp.go | 13 | ||||
-rw-r--r-- | cmd/podman/machine/list.go | 29 | ||||
-rw-r--r-- | cmd/podman/machine/start.go | 2 | ||||
-rw-r--r-- | cmd/podman/pods/create.go | 10 | ||||
-rw-r--r-- | cmd/podman/root.go | 9 | ||||
-rw-r--r-- | cmd/podman/utils/error.go | 2 |
8 files changed, 41 insertions, 32 deletions
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index 9610c29dc..694b97fe5 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -388,10 +388,7 @@ func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts if err != nil { return nil, err } - imageName := config.DefaultInfraImage - podGen.InfraImage = imageName - podGen.InfraContainerSpec = specgen.NewSpecGenerator(imageName, false) - podGen.InfraContainerSpec.RawImageName = imageName + podGen.InfraContainerSpec = specgen.NewSpecGenerator("", false) podGen.InfraContainerSpec.NetworkOptions = podGen.NetworkOptions err = specgenutil.FillOutSpecGen(podGen.InfraContainerSpec, &infraOpts, []string{}) if err != nil { diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go index 70cb76693..cede0ba14 100644 --- a/cmd/podman/containers/rm.go +++ b/cmd/podman/containers/rm.go @@ -61,7 +61,8 @@ func rmFlags(cmd *cobra.Command) { flags.BoolVarP(&rmOptions.All, "all", "a", false, "Remove all containers") flags.BoolVarP(&rmOptions.Ignore, "ignore", "i", false, "Ignore errors when a specified container is missing") - flags.BoolVarP(&rmOptions.Force, "force", "f", false, "Force removal of a running or unusable container. The default is false") + flags.BoolVarP(&rmOptions.Force, "force", "f", false, "Force removal of a running or unusable container") + flags.BoolVar(&rmOptions.Depend, "depend", false, "Remove container and all containers that depend on the selected container") timeFlagName := "time" flags.UintVarP(&stopTimeout, timeFlagName, "t", containerConfig.Engine.StopTimeout, "Seconds to wait for stop before killing the container") _ = cmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone) diff --git a/cmd/podman/images/scp.go b/cmd/podman/images/scp.go index f02a3c15e..fb20d9417 100644 --- a/cmd/podman/images/scp.go +++ b/cmd/podman/images/scp.go @@ -46,6 +46,7 @@ var ( var ( parentFlags []string + quiet bool source entities.ImageScpOptions dest entities.ImageScpOptions sshInfo entities.ImageScpConnections @@ -61,7 +62,7 @@ func init() { func scpFlags(cmd *cobra.Command) { flags := cmd.Flags() - flags.BoolVarP(&source.Quiet, "quiet", "q", false, "Suppress the output") + flags.BoolVarP(&quiet, "quiet", "q", false, "Suppress the output") } func scp(cmd *cobra.Command, args []string) (finalErr error) { @@ -139,6 +140,7 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) { } } + source.Quiet = quiet source.File = f.Name() // after parsing the arguments, set the file for the save/load dest.File = source.File if err = os.Remove(source.File); err != nil { // remove the file and simply use its name so podman creates the file upon save. avoids umask errors @@ -203,15 +205,6 @@ func scp(cmd *cobra.Command, args []string) (finalErr error) { } } - src, err := json.MarshalIndent(source, "", " ") - if err != nil { - return err - } - dst, err := json.MarshalIndent(dest, "", " ") - if err != nil { - return err - } - fmt.Printf("SOURCE: %s\nDEST: %s\n", string(src), string(dst)) return nil } diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go index 858d87401..3d8def0db 100644 --- a/cmd/podman/machine/list.go +++ b/cmd/podman/machine/list.go @@ -32,6 +32,7 @@ var ( Args: validate.NoArgs, ValidArgsFunction: completion.AutocompleteNone, Example: `podman machine list, + podman machine list --format json podman machine ls`, } listFlag = listFlagType{} @@ -43,16 +44,19 @@ type listFlagType struct { } type machineReporter struct { - Name string - Default bool - Created string - Running bool - LastUp string - Stream string - VMType string - CPUs uint64 - Memory string - DiskSize string + Name string + Default bool + Created string + Running bool + LastUp string + Stream string + VMType string + CPUs uint64 + Memory string + DiskSize string + Port int + RemoteUsername string + IdentityPath string } func init() { @@ -96,7 +100,7 @@ func list(cmd *cobra.Command, args []string) error { return err } - b, err := json.Marshal(machineReporter) + b, err := json.MarshalIndent(machineReporter, "", " ") if err != nil { return err } @@ -189,6 +193,9 @@ func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) { response.CPUs = vm.CPUs response.Memory = strUint(vm.Memory) response.DiskSize = strUint(vm.DiskSize) + response.Port = vm.Port + response.RemoteUsername = vm.RemoteUsername + response.IdentityPath = vm.IdentityPath machineResponses = append(machineResponses, response) } diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go index 9c9c24f64..a3770d61a 100644 --- a/cmd/podman/machine/start.go +++ b/cmd/podman/machine/start.go @@ -60,9 +60,9 @@ func start(cmd *cobra.Command, args []string) error { if err != nil { return err } + fmt.Printf("Starting machine %q\n", vmName) if err := vm.Start(vmName, machine.StartOptions{}); err != nil { return err } - fmt.Printf("Machine %q started successfully\n", vmName) return nil } diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index f844812c2..6a28f7a79 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -71,7 +71,11 @@ func init() { _ = createCommand.RegisterFlagCompletionFunc(nameFlagName, completion.AutocompleteNone) infraImageFlagName := "infra-image" - flags.StringVar(&infraImage, infraImageFlagName, containerConfig.Engine.InfraImage, "The image of the infra container to associate with the pod") + var defInfraImage string + if !registry.IsRemote() { + defInfraImage = containerConfig.Engine.InfraImage + } + flags.StringVar(&infraImage, infraImageFlagName, defInfraImage, "The image of the infra container to associate with the pod") _ = createCommand.RegisterFlagCompletionFunc(infraImageFlagName, common.AutocompleteImages) podIDFileFlagName := "pod-id-file" @@ -109,7 +113,9 @@ func create(cmd *cobra.Command, args []string) error { return errors.Wrapf(err, "unable to process labels") } - imageName = infraImage + if cmd.Flag("infra-image").Changed { + imageName = infraImage + } img := imageName if !createOptions.Infra { if cmd.Flag("no-hosts").Changed { diff --git a/cmd/podman/root.go b/cmd/podman/root.go index bccc559ce..1de937ca5 100644 --- a/cmd/podman/root.go +++ b/cmd/podman/root.go @@ -114,6 +114,10 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { } cfg := registry.PodmanConfig() + if cfg.NoOut { + null, _ := os.Open(os.DevNull) + os.Stdout = null + } // Currently it is only possible to restore a container with the same runtime // as used for checkpointing. It should be possible to make crun and runc @@ -137,7 +141,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { runtimeFlag := cmd.Root().Flags().Lookup("runtime") if runtimeFlag == nil { return errors.Errorf( - "Unexcpected error setting runtime to '%s' for restore", + "setting runtime to '%s' for restore", *runtime, ) } @@ -217,7 +221,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { context := cmd.Root().LocalFlags().Lookup("context") if context.Value.String() != "default" { - return errors.New("Podman does not support swarm, the only --context value allowed is \"default\"") + return errors.New("podman does not support swarm, the only --context value allowed is \"default\"") } if !registry.IsRemote() { if cmd.Flag("cpu-profile").Changed { @@ -343,6 +347,7 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) { lFlags.StringVar(&opts.Identity, identityFlagName, ident, "path to SSH identity file, (CONTAINER_SSHKEY)") _ = cmd.RegisterFlagCompletionFunc(identityFlagName, completion.AutocompleteDefault) + lFlags.BoolVar(&opts.NoOut, "noout", false, "do not output to stdout") lFlags.BoolVarP(&opts.Remote, "remote", "r", registry.IsRemote(), "Access remote Podman service") pFlags := cmd.PersistentFlags() if registry.IsRemote() { diff --git a/cmd/podman/utils/error.go b/cmd/podman/utils/error.go index aab1da675..b3b54876f 100644 --- a/cmd/podman/utils/error.go +++ b/cmd/podman/utils/error.go @@ -27,7 +27,7 @@ func (o OutputErrors) PrintErrors() (lastError error) { instead returns a message and we cast it to a new error. Following function performs parsing on build error and returns - exit status which was exepected for this current build + exit status which was expected for this current build */ func ExitCodeFromBuildError(errorMsg string) (int, error) { if strings.Contains(errorMsg, "exit status") { |