From 2444ac9926c651010a60a11eb372cca0ac7cc0e8 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 22 Oct 2018 09:43:03 -0400 Subject: 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 --- libpod/oci.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'libpod/oci.go') 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 } -- cgit v1.2.3-54-g00ecf