mirror of
https://github.com/containers/podman.git
synced 2025-06-19 00:06:43 +08:00
podmanv2 add pre-run to each commmand
each container command needs a prerune because it is not part of the containers subcommand yet Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -15,10 +15,11 @@ import (
|
|||||||
var (
|
var (
|
||||||
killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal."
|
killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal."
|
||||||
killCommand = &cobra.Command{
|
killCommand = &cobra.Command{
|
||||||
Use: "kill [flags] CONTAINER [CONTAINER...]",
|
Use: "kill [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Kill one or more running containers with a specific signal",
|
Short: "Kill one or more running containers with a specific signal",
|
||||||
Long: killDescription,
|
Long: killDescription,
|
||||||
RunE: kill,
|
RunE: kill,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||||
},
|
},
|
||||||
|
@ -15,10 +15,11 @@ import (
|
|||||||
var (
|
var (
|
||||||
pauseDescription = `Pauses one or more running containers. The container name or ID can be used.`
|
pauseDescription = `Pauses one or more running containers. The container name or ID can be used.`
|
||||||
pauseCommand = &cobra.Command{
|
pauseCommand = &cobra.Command{
|
||||||
Use: "pause [flags] CONTAINER [CONTAINER...]",
|
Use: "pause [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Pause all the processes in one or more containers",
|
Short: "Pause all the processes in one or more containers",
|
||||||
Long: pauseDescription,
|
Long: pauseDescription,
|
||||||
RunE: pause,
|
RunE: pause,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Example: `podman pause mywebserver
|
Example: `podman pause mywebserver
|
||||||
podman pause 860a4b23
|
podman pause 860a4b23
|
||||||
podman pause -a`,
|
podman pause -a`,
|
||||||
|
@ -18,10 +18,11 @@ var (
|
|||||||
|
|
||||||
A timeout before forcibly stopping can be set, but defaults to 10 seconds.`
|
A timeout before forcibly stopping can be set, but defaults to 10 seconds.`
|
||||||
restartCommand = &cobra.Command{
|
restartCommand = &cobra.Command{
|
||||||
Use: "restart [flags] CONTAINER [CONTAINER...]",
|
Use: "restart [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Restart one or more containers",
|
Short: "Restart one or more containers",
|
||||||
Long: restartDescription,
|
Long: restartDescription,
|
||||||
RunE: restart,
|
RunE: restart,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||||
},
|
},
|
||||||
|
@ -19,10 +19,11 @@ var (
|
|||||||
|
|
||||||
Command does not remove images. Running or unusable containers will not be removed without the -f option.`
|
Command does not remove images. Running or unusable containers will not be removed without the -f option.`
|
||||||
rmCommand = &cobra.Command{
|
rmCommand = &cobra.Command{
|
||||||
Use: "rm [flags] CONTAINER [CONTAINER...]",
|
Use: "rm [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Remove one or more containers",
|
Short: "Remove one or more containers",
|
||||||
Long: rmDescription,
|
Long: rmDescription,
|
||||||
RunE: rm,
|
RunE: rm,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)
|
return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)
|
||||||
},
|
},
|
||||||
|
@ -18,10 +18,11 @@ var (
|
|||||||
|
|
||||||
A timeout to forcibly stop the container can also be set but defaults to 10 seconds otherwise.`
|
A timeout to forcibly stop the container can also be set but defaults to 10 seconds otherwise.`
|
||||||
stopCommand = &cobra.Command{
|
stopCommand = &cobra.Command{
|
||||||
Use: "stop [flags] CONTAINER [CONTAINER...]",
|
Use: "stop [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Stop one or more containers",
|
Short: "Stop one or more containers",
|
||||||
Long: stopDescription,
|
Long: stopDescription,
|
||||||
RunE: stop,
|
RunE: stop,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)
|
return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)
|
||||||
},
|
},
|
||||||
|
@ -15,10 +15,11 @@ import (
|
|||||||
var (
|
var (
|
||||||
unpauseDescription = `Unpauses one or more previously paused containers. The container name or ID can be used.`
|
unpauseDescription = `Unpauses one or more previously paused containers. The container name or ID can be used.`
|
||||||
unpauseCommand = &cobra.Command{
|
unpauseCommand = &cobra.Command{
|
||||||
Use: "unpause [flags] CONTAINER [CONTAINER...]",
|
Use: "unpause [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Unpause the processes in one or more containers",
|
Short: "Unpause the processes in one or more containers",
|
||||||
Long: unpauseDescription,
|
Long: unpauseDescription,
|
||||||
RunE: unpause,
|
RunE: unpause,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Example: `podman unpause ctrID
|
Example: `podman unpause ctrID
|
||||||
podman unpause --all`,
|
podman unpause --all`,
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@ var (
|
|||||||
waitDescription = `Block until one or more containers stop and then print their exit codes.
|
waitDescription = `Block until one or more containers stop and then print their exit codes.
|
||||||
`
|
`
|
||||||
waitCommand = &cobra.Command{
|
waitCommand = &cobra.Command{
|
||||||
Use: "wait [flags] CONTAINER [CONTAINER...]",
|
Use: "wait [flags] CONTAINER [CONTAINER...]",
|
||||||
Short: "Block on one or more containers",
|
Short: "Block on one or more containers",
|
||||||
Long: waitDescription,
|
Long: waitDescription,
|
||||||
RunE: wait,
|
RunE: wait,
|
||||||
|
PersistentPreRunE: preRunE,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user