mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move names to package api
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
7164b66cfc
commit
dba271a42a
4 changed files with 10 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
package utils
|
package api
|
||||||
|
|
||||||
import "regexp"
|
import "regexp"
|
||||||
|
|
|
@ -7,13 +7,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
validCheckpointNameChars = utils.RestrictedNameChars
|
validCheckpointNameChars = api.RestrictedNameChars
|
||||||
validCheckpointNamePattern = utils.RestrictedNamePattern
|
validCheckpointNamePattern = api.RestrictedNamePattern
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckpointCreate checkpoints the process running in a container with CRIU
|
// CheckpointCreate checkpoints the process running in a container with CRIU
|
||||||
|
|
|
@ -5,16 +5,16 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/container"
|
"github.com/docker/docker/container"
|
||||||
"github.com/docker/docker/pkg/namesgenerator"
|
"github.com/docker/docker/pkg/namesgenerator"
|
||||||
"github.com/docker/docker/pkg/registrar"
|
"github.com/docker/docker/pkg/registrar"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
validContainerNameChars = utils.RestrictedNameChars
|
validContainerNameChars = api.RestrictedNameChars
|
||||||
validContainerNamePattern = utils.RestrictedNamePattern
|
validContainerNamePattern = api.RestrictedNamePattern
|
||||||
)
|
)
|
||||||
|
|
||||||
func (daemon *Daemon) registerName(container *container.Container) error {
|
func (daemon *Daemon) registerName(container *container.Container) error {
|
||||||
|
|
|
@ -16,9 +16,9 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/utils"
|
|
||||||
"github.com/docker/docker/volume"
|
"github.com/docker/docker/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ var (
|
||||||
// volumeNameRegex ensures the name assigned for the volume is valid.
|
// volumeNameRegex ensures the name assigned for the volume is valid.
|
||||||
// This name is used to create the bind directory, so we need to avoid characters that
|
// This name is used to create the bind directory, so we need to avoid characters that
|
||||||
// would make the path to escape the root directory.
|
// would make the path to escape the root directory.
|
||||||
volumeNameRegex = utils.RestrictedNamePattern
|
volumeNameRegex = api.RestrictedNamePattern
|
||||||
)
|
)
|
||||||
|
|
||||||
type validationError struct {
|
type validationError struct {
|
||||||
|
@ -269,7 +269,7 @@ func (r *Root) validateName(name string) error {
|
||||||
return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")}
|
return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")}
|
||||||
}
|
}
|
||||||
if !volumeNameRegex.MatchString(name) {
|
if !volumeNameRegex.MatchString(name) {
|
||||||
return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path", name, utils.RestrictedNameChars)}
|
return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path", name, api.RestrictedNameChars)}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue