diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-11 10:56:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 10:56:11 -0400 |
commit | 39ad0387ca27097875b02b55c6f71c2f2b8bdd6c (patch) | |
tree | 0c870e02eb98c1f1db60d5dd44e7ebf2a7450335 /cmd/podman/pods/start.go | |
parent | f1b6840382ffdfe9811c64b3aea75218d9b14e5e (diff) | |
parent | c7c81a8c081f6f7458345027f315a796d6ca5eda (diff) | |
download | podman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.tar.gz podman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.tar.bz2 podman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.zip |
Merge pull request #6415 from vrothberg/systemd-new-pod
podman-generate-systemd --new for pods
Diffstat (limited to 'cmd/podman/pods/start.go')
-rw-r--r-- | cmd/podman/pods/start.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cmd/podman/pods/start.go b/cmd/podman/pods/start.go index d0150a3c2..97020b360 100644 --- a/cmd/podman/pods/start.go +++ b/cmd/podman/pods/start.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/containers/libpod/cmd/podman/common" "github.com/containers/libpod/cmd/podman/parse" "github.com/containers/libpod/cmd/podman/registry" "github.com/containers/libpod/cmd/podman/utils" @@ -11,6 +12,13 @@ import ( "github.com/spf13/cobra" ) +// allows for splitting API and CLI-only options +type podStartOptionsWrapper struct { + entities.PodStartOptions + + PodIDFiles []string +} + var ( podStartDescription = `The pod name or ID can be used. @@ -21,7 +29,7 @@ var ( Long: podStartDescription, RunE: start, Args: func(cmd *cobra.Command, args []string) error { - return parse.CheckAllLatestAndCIDFile(cmd, args, false, false) + return parse.CheckAllLatestAndPodIDFile(cmd, args, false, true) }, Example: `podman pod start podID podman pod start --latest @@ -30,7 +38,7 @@ var ( ) var ( - startOptions = entities.PodStartOptions{} + startOptions = podStartOptionsWrapper{} ) func init() { @@ -43,6 +51,7 @@ func init() { flags := startCommand.Flags() flags.BoolVarP(&startOptions.All, "all", "a", false, "Restart all running pods") flags.BoolVarP(&startOptions.Latest, "latest", "l", false, "Restart the latest pod podman is aware of") + flags.StringArrayVarP(&startOptions.PodIDFiles, "pod-id-file", "", nil, "Read the pod ID from the file") if registry.IsRemote() { _ = flags.MarkHidden("latest") } @@ -52,7 +61,14 @@ func start(cmd *cobra.Command, args []string) error { var ( errs utils.OutputErrors ) - responses, err := registry.ContainerEngine().PodStart(context.Background(), args, startOptions) + + ids, err := common.ReadPodIDFiles(startOptions.PodIDFiles) + if err != nil { + return err + } + args = append(args, ids...) + + responses, err := registry.ContainerEngine().PodStart(context.Background(), args, startOptions.PodStartOptions) if err != nil { return err } |