Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3638 from weaveworks/pruneowned
Browse files Browse the repository at this point in the history
return error in case Weave CNI plug-in fails to perform CmdDel
  • Loading branch information
bboreham authored May 10, 2019
2 parents 690b6ff + ac9d728 commit 6e78a34
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugin/net/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net"
"os"
"strings"

"github.com/containernetworking/cni/pkg/ipam"
"github.com/containernetworking/cni/pkg/skel"
Expand Down Expand Up @@ -206,7 +207,13 @@ func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
err = ipam.ExecDel(conf.IPAM.Type, args.StdinData)
}
if err != nil {
if strings.Contains(err.Error(), fmt.Sprintf("Delete: no addresses for %s", args.ContainerID)) {
// ignore the error in the case where there are no IP addresses associated with container
fmt.Fprintln(os.Stderr, "weave-cni:", fmt.Sprintf("Delete: no addresses for %s", args.ContainerID))
return nil
}
logOnStderr(fmt.Errorf("unable to release IP address: %s", err))
return err
}
return nil
}
Expand Down

0 comments on commit 6e78a34

Please sign in to comment.