From: Roman Mohr Date: Wed, 11 Oct 2017 09:38:36 +0000 (+0200) Subject: Don't let DHCP delete fail on missing lease X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=cc714265926d48ae626b776dc3ffed41d1aab101;p=plugins.git Don't let DHCP delete fail on missing lease There are at least two reasons why a lease is not present: * The dhcp ipam daemon was restarted * On add the IPAM plugin failed Don't fail the IPAM invocation when the lease is not present, to allow proper device cleanup on CNI delete invocations. --- diff --git a/plugins/ipam/dhcp/daemon.go b/plugins/ipam/dhcp/daemon.go index 0b1dadf..7aa8420 100644 --- a/plugins/ipam/dhcp/daemon.go +++ b/plugins/ipam/dhcp/daemon.go @@ -91,10 +91,9 @@ func (d *DHCP) Release(args *skel.CmdArgs, reply *struct{}) error { if l := d.getLease(args.ContainerID, conf.Name); l != nil { l.Stop() - return nil } - return fmt.Errorf("lease not found: %v/%v", args.ContainerID, conf.Name) + return nil } func (d *DHCP) getLease(contID, netName string) *DHCPLease {