summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-07-04 07:13:51 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-07-08 05:26:56 -0400
commit96dd57ca50de54e82cea177c317b92612ed1cf81 (patch)
treeeca8422dc0416feb0dc3e5f9600a07fb2a544b97 /cmd
parenta2bcf833c98cb38eb28dc65a8768963d0b7344fc (diff)
downloadpodman-96dd57ca50de54e82cea177c317b92612ed1cf81.tar.gz
podman-96dd57ca50de54e82cea177c317b92612ed1cf81.tar.bz2
podman-96dd57ca50de54e82cea177c317b92612ed1cf81.zip
podman wait can take multiple conditions
Podman wait should not be defaulting to just stopped. By default wait API waits for stopped and exited. We should not override this on the client side. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/wait.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index 5b8480781..be92a3cbe 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -41,9 +41,9 @@ var (
)
var (
- waitOptions = entities.WaitOptions{}
- waitCondition string
- waitInterval string
+ waitOptions = entities.WaitOptions{}
+ waitConditions []string
+ waitInterval string
)
func waitFlags(cmd *cobra.Command) {
@@ -54,7 +54,7 @@ func waitFlags(cmd *cobra.Command) {
_ = cmd.RegisterFlagCompletionFunc(intervalFlagName, completion.AutocompleteNone)
conditionFlagName := "condition"
- flags.StringVar(&waitCondition, conditionFlagName, "stopped", "Condition to wait on")
+ flags.StringSliceVar(&waitConditions, conditionFlagName, []string{}, "Condition to wait on")
_ = cmd.RegisterFlagCompletionFunc(conditionFlagName, common.AutocompleteWaitCondition)
}
@@ -92,11 +92,13 @@ func wait(cmd *cobra.Command, args []string) error {
return errors.New("--latest and containers cannot be used together")
}
- cond, err := define.StringToContainerStatus(waitCondition)
- if err != nil {
- return err
+ for _, condition := range waitConditions {
+ cond, err := define.StringToContainerStatus(condition)
+ if err != nil {
+ return err
+ }
+ waitOptions.Condition = append(waitOptions.Condition, cond)
}
- waitOptions.Condition = []define.ContainerStatus{cond}
responses, err := registry.ContainerEngine().ContainerWait(context.Background(), args, waitOptions)
if err != nil {