summaryrefslogtreecommitdiff
path: root/pkg/namespaces/namespaces.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-09-19 10:12:04 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-21 10:13:39 +0000
commit8b9b493b539ee2985b0f4470d62d456e2288d161 (patch)
tree9ea73614bdc99ea173d14470f9a7987cda79614c /pkg/namespaces/namespaces.go
parentfbd1392a46558eb4adb368ba37fdce2b45013c1f (diff)
downloadpodman-8b9b493b539ee2985b0f4470d62d456e2288d161.tar.gz
podman-8b9b493b539ee2985b0f4470d62d456e2288d161.tar.bz2
podman-8b9b493b539ee2985b0f4470d62d456e2288d161.zip
spec: refactor ns modes to a common interface
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1507 Approved by: rhatdan
Diffstat (limited to 'pkg/namespaces/namespaces.go')
-rw-r--r--pkg/namespaces/namespaces.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/namespaces/namespaces.go b/pkg/namespaces/namespaces.go
index 1bdb2b00d..bee833fa9 100644
--- a/pkg/namespaces/namespaces.go
+++ b/pkg/namespaces/namespaces.go
@@ -28,6 +28,16 @@ func (n UsernsMode) Valid() bool {
return true
}
+// IsContainer indicates whether container uses a container userns.
+func (n UsernsMode) IsContainer() bool {
+ return false
+}
+
+// Container is the id of the container which network this container is connected to.
+func (n UsernsMode) Container() string {
+ return ""
+}
+
// UTSMode represents the UTS namespace of the container.
type UTSMode string
@@ -191,8 +201,8 @@ func (n NetworkMode) IsContainer() bool {
return len(parts) > 1 && parts[0] == "container"
}
-// ConnectedContainer is the id of the container which network this container is connected to.
-func (n NetworkMode) ConnectedContainer() string {
+// Container is the id of the container which network this container is connected to.
+func (n NetworkMode) Container() string {
parts := strings.SplitN(string(n), ":", 2)
if len(parts) > 1 {
return parts[1]