diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-07-11 08:06:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 08:06:58 +0000 |
commit | 76422ecdbbd26bf645b664ea7663e5ecf10139ba (patch) | |
tree | ec2f1d80b722efe4a2601478ba7d6e657fc30486 /cmd | |
parent | 87feb82b07ef5b7365c5164ea1f4ee8b928e2b51 (diff) | |
parent | 96dd57ca50de54e82cea177c317b92612ed1cf81 (diff) | |
download | podman-76422ecdbbd26bf645b664ea7663e5ecf10139ba.tar.gz podman-76422ecdbbd26bf645b664ea7663e5ecf10139ba.tar.bz2 podman-76422ecdbbd26bf645b664ea7663e5ecf10139ba.zip |
Merge pull request #14818 from rhatdan/wait
podman wait can take multiple conditions
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/wait.go | 18 |
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 { |