From 2d126f190d5a9c07b3d3aad93244055d8c9d5fc8 Mon Sep 17 00:00:00 2001 From: Yanqiang Miao Date: Fri, 23 Sep 2016 13:06:30 +0800 Subject: [PATCH] Delete a redundant error return Signed-off-by: Yanqiang Miao update Signed-off-by: Yanqiang Miao update Signed-off-by: Yanqiang Miao --- daemon/container_operations.go | 17 ++++++----------- daemon/create.go | 4 +--- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/daemon/container_operations.go b/daemon/container_operations.go index 4271b7f751..c7c5c52864 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -380,12 +380,12 @@ func (daemon *Daemon) findAndAttachNetwork(container *container.Container, idOrN } // updateContainerNetworkSettings update the network settings -func (daemon *Daemon) updateContainerNetworkSettings(container *container.Container, endpointsConfig map[string]*networktypes.EndpointSettings) error { +func (daemon *Daemon) updateContainerNetworkSettings(container *container.Container, endpointsConfig map[string]*networktypes.EndpointSettings) { var n libnetwork.Network mode := container.HostConfig.NetworkMode if container.Config.NetworkDisabled || mode.IsContainer() { - return nil + return } networkName := mode.NetworkName() @@ -435,22 +435,20 @@ func (daemon *Daemon) updateContainerNetworkSettings(container *container.Contai } if !mode.IsUserDefined() { - return nil + return } // Make sure to internally store the per network endpoint config by network name if _, ok := container.NetworkSettings.Networks[networkName]; ok { - return nil + return } if n != nil { if nwConfig, ok := container.NetworkSettings.Networks[n.ID()]; ok { container.NetworkSettings.Networks[networkName] = nwConfig delete(container.NetworkSettings.Networks, n.ID()) - return nil + return } } - - return nil } func (daemon *Daemon) allocateNetwork(container *container.Container) error { @@ -471,10 +469,7 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) error { return nil } - err := daemon.updateContainerNetworkSettings(container, nil) - if err != nil { - return err - } + daemon.updateContainerNetworkSettings(container, nil) updateSettings = true } diff --git a/daemon/create.go b/daemon/create.go index bf8f59c416..1822159e3f 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -135,9 +135,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) ( // backwards API compatibility. container.HostConfig = runconfig.SetDefaultNetModeIfBlank(container.HostConfig) - if err := daemon.updateContainerNetworkSettings(container, endpointsConfigs); err != nil { - return nil, err - } + daemon.updateContainerNetworkSettings(container, endpointsConfigs) if err := container.ToDisk(); err != nil { logrus.Errorf("Error saving new container to disk: %v", err)