summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-10-22 09:43:03 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2018-10-22 09:43:59 -0400
commit2444ac9926c651010a60a11eb372cca0ac7cc0e8 (patch)
tree51ce4dffa6d85261451a23a9185a900a4487a2f5 /libpod/oci.go
parent0fefe3b191444cba8694119b5c30f484d146e162 (diff)
downloadpodman-2444ac9926c651010a60a11eb372cca0ac7cc0e8.tar.gz
podman-2444ac9926c651010a60a11eb372cca0ac7cc0e8.tar.bz2
podman-2444ac9926c651010a60a11eb372cca0ac7cc0e8.zip
Move rootless directory handling to the libpod/pkg/util directory
This should allow us to share this code with buildah. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index f6d320017..6eaaa7a29 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -17,6 +17,7 @@ import (
"github.com/containers/libpod/pkg/ctime"
"github.com/containers/libpod/pkg/rootless"
+ "github.com/containers/libpod/pkg/util"
"github.com/coreos/go-systemd/activation"
"github.com/cri-o/ocicni/pkg/ocicni"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -230,7 +231,7 @@ func bindPorts(ports []ocicni.PortMapping) ([]*os.File, error) {
func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, restoreContainer bool) (err error) {
var stderrBuf bytes.Buffer
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -446,7 +447,7 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
state := new(spec.State)
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -556,7 +557,7 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
// Sets time the container was started, but does not save it.
func (r *OCIRuntime) startContainer(ctr *Container) error {
// TODO: streams should probably *not* be our STDIN/OUT/ERR - redirect to buffers?
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -573,7 +574,7 @@ func (r *OCIRuntime) startContainer(ctr *Container) error {
// killContainer sends the given signal to the given container
func (r *OCIRuntime) killContainer(ctr *Container, signal uint) error {
logrus.Debugf("Sending signal %d to container %s", signal, ctr.ID())
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -636,7 +637,7 @@ func (r *OCIRuntime) stopContainer(ctr *Container, timeout uint) error {
args = []string{"kill", "--all", ctr.ID(), "KILL"}
}
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -667,7 +668,7 @@ func (r *OCIRuntime) deleteContainer(ctr *Container) error {
// pauseContainer pauses the given container
func (r *OCIRuntime) pauseContainer(ctr *Container) error {
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -677,7 +678,7 @@ func (r *OCIRuntime) pauseContainer(ctr *Container) error {
// unpauseContainer unpauses the given container
func (r *OCIRuntime) unpauseContainer(ctr *Container) error {
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}
@@ -698,7 +699,7 @@ func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty
return nil, errors.Wrapf(ErrEmptyID, "must provide a session ID for exec")
}
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return nil, err
}
@@ -780,7 +781,7 @@ func (r *OCIRuntime) execStopContainer(ctr *Container, timeout uint) error {
if len(execSessions) == 0 {
return nil
}
- runtimeDir, err := GetRootlessRuntimeDir()
+ runtimeDir, err := util.GetRootlessRuntimeDir()
if err != nil {
return err
}