Skip to content

Commit

Permalink
Return "not found" errors instead of ignoring them
Browse files Browse the repository at this point in the history
Return errors that contain `"not found"` from CNI plugin DEL
instead of ignoring them, since they can be valid errors and signal that
the interface was not properly deleted.

See discussion here: containerd#102

Signed-off-by: Hamza El-Saawy <[email protected]>
  • Loading branch information
helsaawy committed Jun 10, 2022
1 parent 0984a16 commit 72a49d2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ func (c *libcni) Remove(ctx context.Context, id string, path string, opts ...Nam
// https://github.com/containernetworking/plugins/issues/210
// TODO(random-liu): Remove the error handling when the issue is
// fixed and the CNI spec v0.6.0 support is deprecated.
// NOTE(claudiub): Some CNIs could return a "not found" error, which could mean that
// it was already deleted.
if (path == "" && strings.Contains(err.Error(), "no such file or directory")) || strings.Contains(err.Error(), "not found") {
if path == "" && strings.Contains(err.Error(), "no such file or directory") {
continue
}
return err
Expand Down

0 comments on commit 72a49d2

Please sign in to comment.