Update checking to see if a default network has been provided

Due to changes to libcompose, NetworkConfigs now returns a default
network regardless if one has been provided or not.

An if statement is added that will debug output and ignore the default
network provided that it's the only network available.
This commit is contained in:
Charlie Drage 2017-01-10 09:45:17 -05:00
parent 57039425b6
commit 39fbc4ab9c

View File

@ -81,11 +81,16 @@ func checkUnsupportedKey(composeProject *project.Project) []string {
// collect all keys found in project // collect all keys found in project
var keysFound []string var keysFound []string
// Root level keys // Root level keys are not yet supported
// volume config and network config are not supported // Check to see if the default network is available and length is only equal to one.
if len(composeProject.NetworkConfigs) > 0 { // Else, warn the user that root level networks are not supported (yet)
if _, ok := composeProject.NetworkConfigs["default"]; ok && len(composeProject.NetworkConfigs) == 1 {
logrus.Debug("Default network found")
} else if len(composeProject.NetworkConfigs) > 0 {
keysFound = append(keysFound, "root level networks") keysFound = append(keysFound, "root level networks")
} }
// Root level volumes are not yet supported
if len(composeProject.VolumeConfigs) > 0 { if len(composeProject.VolumeConfigs) > 0 {
keysFound = append(keysFound, "root level volumes") keysFound = append(keysFound, "root level volumes")
} }