refactor: move all internal functions to functions.go

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-09 01:20:39 -05:00
parent 231078125a
commit 52ef7e7cdc
4 changed files with 114 additions and 88 deletions

View File

@@ -81,23 +81,15 @@ func CommandDestroy(networkName string, forceDestroy bool) error {
// CommandExists checks if a network exists
func CommandExists(networkName string) error {
exists := false
if networkName == "" {
return errors.New("No network name specified")
}
networks, err := ListNetworks()
exists, err := networkExists(networkName)
if err != nil {
return err
}
for _, n := range networks {
if networkName == n {
exists = true
break
}
}
if exists {
common.LogInfo1Quiet("Network exists")
} else {
@@ -114,7 +106,7 @@ func CommandInfo() error {
// CommandList is an alias for "docker network ls"
func CommandList() error {
networks, err := ListNetworks()
networks, err := listNetworks()
if err != nil {
return err
}
@@ -186,19 +178,3 @@ func CommandSet(appName string, property string, value string) {
common.CommandPropertySet("network", appName, property, value, DefaultProperties)
}
func isConflictingPropertyValue(appName string, property string, value string) bool {
if value == "" {
return false
}
otherProperty := "attach-post-create"
if property == otherProperty {
otherProperty = "attach-post-deploy"
}
defaultValue := GetDefaultValue(otherProperty)
otherValue := common.PropertyGetDefault("network", appName, otherProperty, defaultValue)
return value == otherValue
}