plugins/*: Don't error if the device doesn't exist
I wasn't able to test or update the dhcp plugin but from a code read it should be fine. All the other plugins are tested and fixed
This commit is contained in:
@ -191,9 +191,18 @@ func cmdDel(args *skel.CmdArgs) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
|
||||
return ip.DelLinkByName(args.IfName)
|
||||
// There is a netns so try to clean up. Delete can be called multiple times
|
||||
// so don't return an error if the device is already removed.
|
||||
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
|
||||
if _, err := ip.DelLinkByNameAddr(args.IfName, netlink.FAMILY_V4); err != nil {
|
||||
if err != ip.ErrLinkNotFound {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
Reference in New Issue
Block a user