1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix bad import graph from opts/opts.go

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-08-29 15:28:33 -04:00
parent 15b8d0420b
commit b68221c37e
4 changed files with 24 additions and 22 deletions

View file

@ -502,7 +502,7 @@ func Validate(config *Config) error {
}
}
if _, err := opts.ParseGenericResources(config.NodeGenericResources); err != nil {
if _, err := ParseGenericResources(config.NodeGenericResources); err != nil {
return err
}

22
daemon/config/opts.go Normal file
View file

@ -0,0 +1,22 @@
package config
import (
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/daemon/cluster/convert"
"github.com/docker/swarmkit/api/genericresource"
)
// ParseGenericResources parses and validates the specified string as a list of GenericResource
func ParseGenericResources(value string) ([]swarm.GenericResource, error) {
if value == "" {
return nil, nil
}
resources, err := genericresource.Parse(value)
if err != nil {
return nil, err
}
obj := convert.GenericResourcesFromGRPC(resources)
return obj, nil
}

View file

@ -29,7 +29,6 @@ import (
"github.com/docker/docker/daemon/events"
"github.com/docker/docker/daemon/exec"
"github.com/docker/docker/daemon/logger"
"github.com/docker/docker/opts"
"github.com/sirupsen/logrus"
// register graph drivers
_ "github.com/docker/docker/daemon/graphdriver/register"
@ -1053,7 +1052,7 @@ func (daemon *Daemon) setupInitLayer(initPath string) error {
}
func (daemon *Daemon) setGenericResources(conf *config.Config) error {
genericResources, err := opts.ParseGenericResources(conf.NodeGenericResources)
genericResources, err := config.ParseGenericResources(conf.NodeGenericResources)
if err != nil {
return err
}

View file

@ -7,10 +7,7 @@ import (
"regexp"
"strings"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/daemon/cluster/convert"
units "github.com/docker/go-units"
"github.com/docker/swarmkit/api/genericresource"
)
var (
@ -328,19 +325,3 @@ func (m *MemBytes) UnmarshalJSON(s []byte) error {
*m = MemBytes(val)
return err
}
// ParseGenericResources parses and validates the specified string as a list of GenericResource
func ParseGenericResources(value string) ([]swarm.GenericResource, error) {
if value == "" {
return nil, nil
}
resources, err := genericresource.Parse(value)
if err != nil {
return nil, err
}
obj := convert.GenericResourcesFromGRPC(resources)
return obj, nil
}