mirror of https://github.com/docker/cli.git
Fix external networks
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
29d3510d50
commit
9da2602f38
|
@ -62,7 +62,7 @@ func Networks(namespace Namespace, networks networkMap, servicesNetworks map[str
|
||||||
for internalName := range servicesNetworks {
|
for internalName := range servicesNetworks {
|
||||||
network := networks[internalName]
|
network := networks[internalName]
|
||||||
if network.External.External {
|
if network.External.External {
|
||||||
externalNetworks = append(externalNetworks, network.External.Name)
|
externalNetworks = append(externalNetworks, network.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,8 @@ func TestNetworks(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"outside": composetypes.NetworkConfig{
|
"outside": composetypes.NetworkConfig{
|
||||||
External: composetypes.External{
|
External: composetypes.External{External: true},
|
||||||
External: true,
|
Name: "special",
|
||||||
Name: "special",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"attachablenet": composetypes.NetworkConfig{
|
"attachablenet": composetypes.NetworkConfig{
|
||||||
Driver: "overlay",
|
Driver: "overlay",
|
||||||
|
|
|
@ -230,7 +230,7 @@ func convertServiceNetworks(
|
||||||
}
|
}
|
||||||
target := namespace.Scope(networkName)
|
target := namespace.Scope(networkName)
|
||||||
if networkConfig.External.External {
|
if networkConfig.External.External {
|
||||||
target = networkConfig.External.Name
|
target = networkConfig.Name
|
||||||
}
|
}
|
||||||
netAttachConfig := swarm.NetworkAttachmentConfig{
|
netAttachConfig := swarm.NetworkAttachmentConfig{
|
||||||
Target: target,
|
Target: target,
|
||||||
|
|
|
@ -219,10 +219,8 @@ func TestConvertServiceNetworksOnlyDefault(t *testing.T) {
|
||||||
func TestConvertServiceNetworks(t *testing.T) {
|
func TestConvertServiceNetworks(t *testing.T) {
|
||||||
networkConfigs := networkMap{
|
networkConfigs := networkMap{
|
||||||
"front": composetypes.NetworkConfig{
|
"front": composetypes.NetworkConfig{
|
||||||
External: composetypes.External{
|
External: composetypes.External{External: true},
|
||||||
External: true,
|
Name: "fronttier",
|
||||||
Name: "fronttier",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"back": composetypes.NetworkConfig{},
|
"back": composetypes.NetworkConfig{},
|
||||||
}
|
}
|
||||||
|
@ -259,10 +257,8 @@ func TestConvertServiceNetworks(t *testing.T) {
|
||||||
func TestConvertServiceNetworksCustomDefault(t *testing.T) {
|
func TestConvertServiceNetworksCustomDefault(t *testing.T) {
|
||||||
networkConfigs := networkMap{
|
networkConfigs := networkMap{
|
||||||
"default": composetypes.NetworkConfig{
|
"default": composetypes.NetworkConfig{
|
||||||
External: composetypes.External{
|
External: composetypes.External{External: true},
|
||||||
External: true,
|
Name: "custom",
|
||||||
Name: "custom",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
networks := map[string]*composetypes.ServiceNetworkConfig{}
|
networks := map[string]*composetypes.ServiceNetworkConfig{}
|
||||||
|
|
Loading…
Reference in New Issue