소스 검색

Network not deleted after stack is removed

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>
(cherry picked from commit 70fa7b6a3fd9aaada582ae02c50710f218b54d1a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Arko Dasgupta 6 년 전
부모
커밋
2b216674da
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      daemon/cluster/executor/container/controller.go

+ 4 - 7
daemon/cluster/executor/container/controller.go

@@ -369,20 +369,17 @@ func (r *controller) Shutdown(ctx context.Context) error {
 	}
 	}
 
 
 	if err := r.adapter.shutdown(ctx); err != nil {
 	if err := r.adapter.shutdown(ctx); err != nil {
-		if isUnknownContainer(err) || isStoppedContainer(err) {
-			return nil
+		if !(isUnknownContainer(err) || isStoppedContainer(err)) {
+			return err
 		}
 		}
-
-		return err
 	}
 	}
 
 
 	// Try removing networks referenced in this task in case this
 	// Try removing networks referenced in this task in case this
 	// task is the last one referencing it
 	// task is the last one referencing it
 	if err := r.adapter.removeNetworks(ctx); err != nil {
 	if err := r.adapter.removeNetworks(ctx); err != nil {
-		if isUnknownContainer(err) {
-			return nil
+		if !isUnknownContainer(err) {
+			return err
 		}
 		}
-		return err
 	}
 	}
 
 
 	return nil
 	return nil