зеркало из https://github.com/microsoft/docker.git
Fix bad import graph from opts/opts.go
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Родитель
15b8d0420b
Коммит
b68221c37e
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
|
19
opts/opts.go
19
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
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче