Browse code

Fix bad import graph from opts/opts.go

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2017/08/30 04:28:33
Showing 4 changed files
... ...
@@ -502,7 +502,7 @@ func Validate(config *Config) error {
502 502
 		}
503 503
 	}
504 504
 
505
-	if _, err := opts.ParseGenericResources(config.NodeGenericResources); err != nil {
505
+	if _, err := ParseGenericResources(config.NodeGenericResources); err != nil {
506 506
 		return err
507 507
 	}
508 508
 
509 509
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+package config
1
+
2
+import (
3
+	"github.com/docker/docker/api/types/swarm"
4
+	"github.com/docker/docker/daemon/cluster/convert"
5
+	"github.com/docker/swarmkit/api/genericresource"
6
+)
7
+
8
+// ParseGenericResources parses and validates the specified string as a list of GenericResource
9
+func ParseGenericResources(value string) ([]swarm.GenericResource, error) {
10
+	if value == "" {
11
+		return nil, nil
12
+	}
13
+
14
+	resources, err := genericresource.Parse(value)
15
+	if err != nil {
16
+		return nil, err
17
+	}
18
+
19
+	obj := convert.GenericResourcesFromGRPC(resources)
20
+	return obj, nil
21
+}
... ...
@@ -29,7 +29,6 @@ import (
29 29
 	"github.com/docker/docker/daemon/events"
30 30
 	"github.com/docker/docker/daemon/exec"
31 31
 	"github.com/docker/docker/daemon/logger"
32
-	"github.com/docker/docker/opts"
33 32
 	"github.com/sirupsen/logrus"
34 33
 	// register graph drivers
35 34
 	_ "github.com/docker/docker/daemon/graphdriver/register"
... ...
@@ -1053,7 +1052,7 @@ func (daemon *Daemon) setupInitLayer(initPath string) error {
1053 1053
 }
1054 1054
 
1055 1055
 func (daemon *Daemon) setGenericResources(conf *config.Config) error {
1056
-	genericResources, err := opts.ParseGenericResources(conf.NodeGenericResources)
1056
+	genericResources, err := config.ParseGenericResources(conf.NodeGenericResources)
1057 1057
 	if err != nil {
1058 1058
 		return err
1059 1059
 	}
... ...
@@ -7,10 +7,7 @@ import (
7 7
 	"regexp"
8 8
 	"strings"
9 9
 
10
-	"github.com/docker/docker/api/types/swarm"
11
-	"github.com/docker/docker/daemon/cluster/convert"
12 10
 	units "github.com/docker/go-units"
13
-	"github.com/docker/swarmkit/api/genericresource"
14 11
 )
15 12
 
16 13
 var (
... ...
@@ -328,19 +325,3 @@ func (m *MemBytes) UnmarshalJSON(s []byte) error {
328 328
 	*m = MemBytes(val)
329 329
 	return err
330 330
 }
331
-
332
-// ParseGenericResources parses and validates the specified string as a list of GenericResource
333
-func ParseGenericResources(value string) ([]swarm.GenericResource, error) {
334
-	if value == "" {
335
-		return nil, nil
336
-	}
337
-
338
-	resources, err := genericresource.Parse(value)
339
-	if err != nil {
340
-		return nil, err
341
-	}
342
-
343
-	obj := convert.GenericResourcesFromGRPC(resources)
344
-
345
-	return obj, nil
346
-}