Merge pull request #743 from dnephin/compose-add-name-to-network

Fix external networks in stacks
This commit is contained in:
Sebastiaan van Stijn 2017-12-11 19:26:55 -08:00 committed by GitHub
commit eb5e32e78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 14 deletions

View File

@ -62,7 +62,7 @@ func Networks(namespace Namespace, networks networkMap, servicesNetworks map[str
for internalName := range servicesNetworks {
network := networks[internalName]
if network.External.External {
externalNetworks = append(externalNetworks, network.External.Name)
externalNetworks = append(externalNetworks, network.Name)
continue
}

View File

@ -55,11 +55,9 @@ func TestNetworks(t *testing.T) {
},
},
"outside": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
External: composetypes.External{External: true},
Name: "special",
},
},
"attachablenet": composetypes.NetworkConfig{
Driver: "overlay",
Attachable: true,

View File

@ -230,7 +230,7 @@ func convertServiceNetworks(
}
target := namespace.Scope(networkName)
if networkConfig.External.External {
target = networkConfig.External.Name
target = networkConfig.Name
}
netAttachConfig := swarm.NetworkAttachmentConfig{
Target: target,

View File

@ -219,11 +219,9 @@ func TestConvertServiceNetworksOnlyDefault(t *testing.T) {
func TestConvertServiceNetworks(t *testing.T) {
networkConfigs := networkMap{
"front": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
External: composetypes.External{External: true},
Name: "fronttier",
},
},
"back": composetypes.NetworkConfig{},
}
networks := map[string]*composetypes.ServiceNetworkConfig{
@ -259,11 +257,9 @@ func TestConvertServiceNetworks(t *testing.T) {
func TestConvertServiceNetworksCustomDefault(t *testing.T) {
networkConfigs := networkMap{
"default": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
External: composetypes.External{External: true},
Name: "custom",
},
},
}
networks := map[string]*composetypes.ServiceNetworkConfig{}