mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26848 from miaoyq/del-a-redundant-err-return
Delete a redundant error return
This commit is contained in:
commit
0ab13dda66
2 changed files with 7 additions and 14 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue