mirror of
https://github.com/containers/podman.git
synced 2025-10-19 20:23:08 +08:00
Merge pull request #23457 from Luap99/play-kube-cleanup
fix network cleanup flake in play kube
This commit is contained in:
@ -169,18 +169,21 @@ func (p *Pod) stopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
|
|||||||
// Can't batch these without forcing Stop() to hold the
|
// Can't batch these without forcing Stop() to hold the
|
||||||
// lock for the full duration of the timeout.
|
// lock for the full duration of the timeout.
|
||||||
// We probably don't want to do that.
|
// We probably don't want to do that.
|
||||||
|
var err error
|
||||||
if timeout > -1 {
|
if timeout > -1 {
|
||||||
if err := c.StopWithTimeout(uint(timeout)); err != nil {
|
err = c.StopWithTimeout(uint(timeout))
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if err := c.Stop(); err != nil {
|
err = c.Stop()
|
||||||
return err
|
}
|
||||||
}
|
if err != nil && !errors.Is(err, define.ErrCtrStateInvalid) && !errors.Is(err, define.ErrCtrStopped) {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if cleanup {
|
if cleanup {
|
||||||
return c.Cleanup(ctx)
|
err := c.Cleanup(ctx)
|
||||||
|
if err != nil && !errors.Is(err, define.ErrCtrStateInvalid) && !errors.Is(err, define.ErrCtrStopped) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -196,9 +199,6 @@ func (p *Pod) stopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
|
|||||||
// Get returned error for every container we worked on
|
// Get returned error for every container we worked on
|
||||||
for id, channel := range ctrErrChan {
|
for id, channel := range ctrErrChan {
|
||||||
if err := <-channel; err != nil {
|
if err := <-channel; err != nil {
|
||||||
if errors.Is(err, define.ErrCtrStateInvalid) || errors.Is(err, define.ErrCtrStopped) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
ctrErrors[id] = err
|
ctrErrors[id] = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user