mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move validateOpts()
to local_unix.go as it is not used on Windows
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
11b88be247
commit
0d6dd91e13
3 changed files with 18 additions and 22 deletions
|
@ -344,23 +344,6 @@ func (v *localVolume) unmount() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateOpts(opts map[string]string) error {
|
||||
if len(opts) == 0 {
|
||||
return nil
|
||||
}
|
||||
for opt := range opts {
|
||||
if _, ok := validOpts[opt]; !ok {
|
||||
return errdefs.InvalidParameter(errors.Errorf("invalid option: %q", opt))
|
||||
}
|
||||
}
|
||||
for opt := range mandatoryOpts {
|
||||
if _, ok := opts[opt]; !ok {
|
||||
return errdefs.InvalidParameter(errors.Errorf("missing required option: %q", opt))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *localVolume) Status() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -74,6 +75,23 @@ func setOpts(v *localVolume, opts map[string]string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateOpts(opts map[string]string) error {
|
||||
if len(opts) == 0 {
|
||||
return nil
|
||||
}
|
||||
for opt := range opts {
|
||||
if _, ok := validOpts[opt]; !ok {
|
||||
return errdefs.InvalidParameter(errors.Errorf("invalid option: %q", opt))
|
||||
}
|
||||
}
|
||||
for opt := range mandatoryOpts {
|
||||
if _, ok := opts[opt]; !ok {
|
||||
return errdefs.InvalidParameter(errors.Errorf("missing required option: %q", opt))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *localVolume) mount() error {
|
||||
if v.opts.MountDevice == "" {
|
||||
return fmt.Errorf("missing device in volume options")
|
||||
|
|
|
@ -16,11 +16,6 @@ import (
|
|||
|
||||
type optsConfig struct{}
|
||||
|
||||
var (
|
||||
validOpts map[string]struct{}
|
||||
mandatoryOpts map[string]struct{}
|
||||
)
|
||||
|
||||
// scopedPath verifies that the path where the volume is located
|
||||
// is under Docker's root and the valid local paths.
|
||||
func (r *Root) scopedPath(realPath string) bool {
|
||||
|
|
Loading…
Add table
Reference in a new issue