summaryrefslogtreecommitdiff
path: root/libpod/define
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-21 19:55:58 +0200
committerGitHub <noreply@github.com>2020-05-21 19:55:58 +0200
commit9d3b46624b4eb3b6eeea38b5b1057914a9ff2baf (patch)
tree54fbc064fe4f7723407ed8d217148c0b1be4cb7a /libpod/define
parentc3b6e623bba748fcfdae4f755e04c7185a85e79c (diff)
parent0d0565f55ee3399f5c2c4e4b73acb732b424f3db (diff)
downloadpodman-9d3b46624b4eb3b6eeea38b5b1057914a9ff2baf.tar.gz
podman-9d3b46624b4eb3b6eeea38b5b1057914a9ff2baf.tar.bz2
podman-9d3b46624b4eb3b6eeea38b5b1057914a9ff2baf.zip
Merge pull request #6323 from rhatdan/shrink
Remove github.com/libpod/libpod from cmd/pkg/podman
Diffstat (limited to 'libpod/define')
-rw-r--r--libpod/define/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/define/config.go b/libpod/define/config.go
index 692eafb04..5ca4da4af 100644
--- a/libpod/define/config.go
+++ b/libpod/define/config.go
@@ -3,6 +3,9 @@ package define
import (
"bufio"
"io"
+ "regexp"
+
+ "github.com/pkg/errors"
)
var (
@@ -10,6 +13,13 @@ var (
DefaultSHMLockPath = "/libpod_lock"
// DefaultRootlessSHMLockPath is the default path for rootless SHM locks
DefaultRootlessSHMLockPath = "/libpod_rootless_lock"
+
+ // NameRegex is a regular expression to validate container/pod names.
+ // This must NOT be changed from outside of Libpod. It should be a
+ // constant, but Go won't let us do that.
+ NameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
+ // RegexError is thrown in presence of an invalid container/pod name.
+ RegexError = errors.Wrapf(ErrInvalidArg, "names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*")
)
const (