Skip to content

Commit 40bcf8e

Browse files
authored
Merge pull request #32 from Random-Liu/ignore-error-for-empty-path
Only ignore "no such file or directory" error for empty path
2 parents cc959f7 + 5ce81a6 commit 40bcf8e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cni.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,16 @@ func (c *libcni) Remove(id string, path string, opts ...NamespaceOpts) error {
127127
return err
128128
}
129129
for _, network := range c.networks {
130-
if err := network.Remove(ns); err != nil && !strings.Contains(err.Error(), "no such file or directory") {
130+
if err := network.Remove(ns); err != nil {
131+
// Based on CNI spec v0.7.0, empty network namespace is allowed to
132+
// do best effort cleanup. However, it is not handled consistently
133+
// right now:
134+
// https://github.com/containernetworking/plugins/issues/210
135+
// TODO(random-liu): Remove the error handling when the issue is
136+
// fixed and the CNI spec v0.6.0 support is deprecated.
137+
if path == "" && strings.Contains(err.Error(), "no such file or directory") {
138+
continue
139+
}
131140
return err
132141
}
133142
}

0 commit comments

Comments
 (0)