From b68221c37ee597950364788204546f9c9d0e46a1 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 29 Aug 2017 15:28:33 -0400 Subject: [PATCH] Fix bad import graph from opts/opts.go Signed-off-by: Daniel Nephin --- daemon/config/config.go | 2 +- daemon/config/opts.go | 22 ++++++++++++++++++++++ daemon/daemon.go | 3 +-- opts/opts.go | 19 ------------------- 4 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 daemon/config/opts.go diff --git a/daemon/config/config.go b/daemon/config/config.go index 74441d1a5c..d01d4a4fb4 100644 --- a/daemon/config/config.go +++ b/daemon/config/config.go @@ -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 } diff --git a/daemon/config/opts.go b/daemon/config/opts.go new file mode 100644 index 0000000000..00f32e43bb --- /dev/null +++ b/daemon/config/opts.go @@ -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 +} diff --git a/daemon/daemon.go b/daemon/daemon.go index 2ba0288e13..a11a1f8691 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -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 } diff --git a/opts/opts.go b/opts/opts.go index 300fb426ad..8d82f76792 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -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 -}