Merge pull request #37409 from ctelfer/rm-libnet-error-wrapping

Fix faulty error type checking in removeNetwork()
Upstream-commit: 905811f366f28c1712626817f5fb086bd4072a78
Component: engine
This commit is contained in:
Sebastiaan van Stijn
2018-07-08 20:18:40 +02:00
committed by GitHub

View File

@ -4,7 +4,6 @@ import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"os"
@ -28,6 +27,7 @@ import (
"github.com/docker/swarmkit/log"
gogotypes "github.com/gogo/protobuf/types"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/time/rate"
)
@ -172,7 +172,7 @@ func (c *containerAdapter) createNetworks(ctx context.Context) error {
func (c *containerAdapter) removeNetworks(ctx context.Context) error {
for name, v := range c.container.networksAttachments {
if err := c.backend.DeleteManagedNetwork(v.Network.ID); err != nil {
switch err.(type) {
switch errors.Cause(err).(type) {
case *libnetwork.ActiveEndpointsError:
continue
case libnetwork.ErrNoSuchNetwork: