summaryrefslogtreecommitdiff
path: root/pkg/specgen/namespaces.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-02-26 15:15:36 -0600
committerBrent Baude <bbaude@redhat.com>2020-03-06 14:31:45 -0600
commit8b5e2a6297e6f6a5426551d1648278906a9d23de (patch)
tree7de8fe4102b581404dc3c012445750008a5b5495 /pkg/specgen/namespaces.go
parenta61d05f667f6ba74ed060d5938e99d9838c1763f (diff)
downloadpodman-8b5e2a6297e6f6a5426551d1648278906a9d23de.tar.gz
podman-8b5e2a6297e6f6a5426551d1648278906a9d23de.tar.bz2
podman-8b5e2a6297e6f6a5426551d1648278906a9d23de.zip
add default network for apiv2 create
during container creation, if no network is provided, we need to add a default value so the container can be later started. use apiv2 container creation for RunTopContainer instead of an exec to the system podman. RunTopContainer now also returns the container id and an error. added a libpod commit endpoint. also, changed the use of the connections and bindings slightly to make it more convenient to write tests. Fixes: 5366 Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/specgen/namespaces.go')
-rw-r--r--pkg/specgen/namespaces.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go
index 79a83819a..fa2dee77d 100644
--- a/pkg/specgen/namespaces.go
+++ b/pkg/specgen/namespaces.go
@@ -70,9 +70,7 @@ func (n *Namespace) IsPrivate() bool {
return n.NSMode == Private
}
-// validate perform simple validation on the namespace to make sure it is not
-// invalid from the get-go
-func (n *Namespace) validate() error {
+func validateNetNS(n *Namespace) error {
if n == nil {
return nil
}
@@ -82,6 +80,15 @@ func (n *Namespace) validate() error {
default:
return errors.Errorf("invalid network %q", n.NSMode)
}
+ return nil
+}
+
+// validate perform simple validation on the namespace to make sure it is not
+// invalid from the get-go
+func (n *Namespace) validate() error {
+ if n == nil {
+ return nil
+ }
// Path and From Container MUST have a string value set
if n.NSMode == Path || n.NSMode == FromContainer {
if len(n.Value) < 1 {