Make sure adapter.removeNetworks executes during task Remove
adapter.removeNetworks was being skipped for cases when
isUnknownContainer(err) was true after adapter.remove was executed
This fix eliminates the nil return case forcing the function
to continue executing unless there is a true error
Fixes https://github.com/moby/moby/issues/39225
Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
| ... | ... |
@@ -369,20 +369,17 @@ func (r *controller) Shutdown(ctx context.Context) error {
|
| 369 | 369 |
} |
| 370 | 370 |
|
| 371 | 371 |
if err := r.adapter.shutdown(ctx); err != nil {
|
| 372 |
- if isUnknownContainer(err) || isStoppedContainer(err) {
|
|
| 373 |
- return nil |
|
| 372 |
+ if !(isUnknownContainer(err) || isStoppedContainer(err)) {
|
|
| 373 |
+ return err |
|
| 374 | 374 |
} |
| 375 |
- |
|
| 376 |
- return err |
|
| 377 | 375 |
} |
| 378 | 376 |
|
| 379 | 377 |
// Try removing networks referenced in this task in case this |
| 380 | 378 |
// task is the last one referencing it |
| 381 | 379 |
if err := r.adapter.removeNetworks(ctx); err != nil {
|
| 382 |
- if isUnknownContainer(err) {
|
|
| 383 |
- return nil |
|
| 380 |
+ if !isUnknownContainer(err) {
|
|
| 381 |
+ return err |
|
| 384 | 382 |
} |
| 385 |
- return err |
|
| 386 | 383 |
} |
| 387 | 384 |
|
| 388 | 385 |
return nil |