Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix external networks in stacks #743

Merged
merged 1 commit into from Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/compose/convert/compose.go
Expand Up @@ -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
}

Expand Down
6 changes: 2 additions & 4 deletions cli/compose/convert/compose_test.go
Expand Up @@ -55,10 +55,8 @@ func TestNetworks(t *testing.T) {
},
},
"outside": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
Name: "special",
},
External: composetypes.External{External: true},
Name: "special",
},
"attachablenet": composetypes.NetworkConfig{
Driver: "overlay",
Expand Down
2 changes: 1 addition & 1 deletion cli/compose/convert/service.go
Expand Up @@ -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,
Expand Down
12 changes: 4 additions & 8 deletions cli/compose/convert/service_test.go
Expand Up @@ -219,10 +219,8 @@ func TestConvertServiceNetworksOnlyDefault(t *testing.T) {
func TestConvertServiceNetworks(t *testing.T) {
networkConfigs := networkMap{
"front": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
Name: "fronttier",
},
External: composetypes.External{External: true},
Name: "fronttier",
},
"back": composetypes.NetworkConfig{},
}
Expand Down Expand Up @@ -259,10 +257,8 @@ func TestConvertServiceNetworks(t *testing.T) {
func TestConvertServiceNetworksCustomDefault(t *testing.T) {
networkConfigs := networkMap{
"default": composetypes.NetworkConfig{
External: composetypes.External{
External: true,
Name: "custom",
},
External: composetypes.External{External: true},
Name: "custom",
},
}
networks := map[string]*composetypes.ServiceNetworkConfig{}
Expand Down