Skip to content

Commit

Permalink
Move names to a more appropriate package.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
  • Loading branch information
dnephin committed Sep 6, 2017
1 parent d7b4c7e commit 22b2464
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions daemon/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"os"
"path/filepath"

"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
"github.com/docker/docker/daemon/names"
)

var (
validCheckpointNameChars = api.RestrictedNameChars
validCheckpointNamePattern = api.RestrictedNamePattern
validCheckpointNameChars = names.RestrictedNameChars
validCheckpointNamePattern = names.RestrictedNamePattern
)

// getCheckpointDir verifies checkpoint directory for create,remove, list options and checks if checkpoint already exists
Expand Down
6 changes: 3 additions & 3 deletions daemon/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import (
"fmt"
"strings"

"github.com/docker/docker/api"
"github.com/docker/docker/container"
"github.com/docker/docker/daemon/names"
"github.com/docker/docker/pkg/namesgenerator"
"github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

var (
validContainerNameChars = api.RestrictedNameChars
validContainerNamePattern = api.RestrictedNamePattern
validContainerNameChars = names.RestrictedNameChars
validContainerNamePattern = names.RestrictedNamePattern
)

func (daemon *Daemon) registerName(container *container.Container) error {
Expand Down
2 changes: 1 addition & 1 deletion api/names.go → daemon/names/names.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package names

import "regexp"

Expand Down
6 changes: 3 additions & 3 deletions volume/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"strings"
"sync"

"github.com/docker/docker/api"
"github.com/docker/docker/daemon/names"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/volume"
Expand All @@ -35,7 +35,7 @@ var (
// 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
// would make the path to escape the root directory.
volumeNameRegex = api.RestrictedNamePattern
volumeNameRegex = names.RestrictedNamePattern
)

type activeMount struct {
Expand Down Expand Up @@ -298,7 +298,7 @@ func (r *Root) validateName(name string) error {
return validationError("volume name is too short, names should be at least two alphanumeric characters")
}
if !volumeNameRegex.MatchString(name) {
return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, api.RestrictedNameChars))
return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, names.RestrictedNameChars))
}
return nil
}
Expand Down

0 comments on commit 22b2464

Please sign in to comment.