mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Get err type in removeNetworks() w/ errors.Cause()
Commit c0bc14e8
wrapped the return value of nw.Delete() with some extra
information. However, this breaks the code in
containerAdaptor.removeNetworks() which ignores certain specific
libnetwork error return codes. Said codes actually don't represent
errors, but just regular conditions to be expected in normal operation.
The removeNetworks() call checked for these errors by type assertions
which the errors.Wrap(err...) breaks.
This has a cascading effect, because controller.Remove() invokes
containerAdaptor.removeNetworks() and if the latter returns an error,
then Remove() fails to remove the container itself. This is not
necessarily catastrophic since the container reaper apparently will
purge the container later, but it is clearly not the behavior we want.
Signed-off-by: Chris Telfer <ctelfer@docker.com>
This commit is contained in:
parent
aba2735e3f
commit
6225d1f15c
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue