summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-06-24 15:48:34 -0500
committerbaude <bbaude@redhat.com>2019-06-25 13:51:24 -0500
commitdd81a44ccfa34585ef62319835c8bb421db9e334 (patch)
tree7bab006a56d5823ccdf7b8cf6e59502ee954a979 /libpod/oci.go
parenta1a4a75abee2c381483a218e1660621ee416ef7c (diff)
downloadpodman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.gz
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.tar.bz2
podman-dd81a44ccfa34585ef62319835c8bb421db9e334.zip
remove libpod from main
the compilation demands of having libpod in main is a burden for the remote client compilations. to combat this, we should move the use of libpod structs, vars, constants, and functions into the adapter code where it will only be compiled by the local client. this should result in cleaner code organization and smaller binaries. it should also help if we ever need to compile the remote client on non-Linux operating systems natively (not cross-compiled). Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 36c1dea84..343738a3a 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -11,6 +11,7 @@ import (
"strings"
"time"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/util"
"github.com/cri-o/ocicni/pkg/ocicni"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -79,7 +80,7 @@ type ociError struct {
// The first path that points to a valid executable will be used.
func newOCIRuntime(name string, paths []string, conmonPath string, runtimeCfg *RuntimeConfig, supportsJSON bool) (*OCIRuntime, error) {
if name == "" {
- return nil, errors.Wrapf(ErrInvalidArg, "the OCI runtime must be provided a non-empty name")
+ return nil, errors.Wrapf(define.ErrInvalidArg, "the OCI runtime must be provided a non-empty name")
}
runtime := new(OCIRuntime)
@@ -114,14 +115,14 @@ func newOCIRuntime(name string, paths []string, conmonPath string, runtimeCfg *R
break
}
if !foundPath {
- return nil, errors.Wrapf(ErrInvalidArg, "no valid executable found for OCI runtime %s", name)
+ return nil, errors.Wrapf(define.ErrInvalidArg, "no valid executable found for OCI runtime %s", name)
}
runtime.exitsDir = filepath.Join(runtime.tmpDir, "exits")
runtime.socketsDir = filepath.Join(runtime.tmpDir, "socket")
if runtime.cgroupManager != CgroupfsCgroupsManager && runtime.cgroupManager != SystemdCgroupsManager {
- return nil, errors.Wrapf(ErrInvalidArg, "invalid cgroup manager specified: %s", runtime.cgroupManager)
+ return nil, errors.Wrapf(define.ErrInvalidArg, "invalid cgroup manager specified: %s", runtime.cgroupManager)
}
// Create the exit files and attach sockets directories
@@ -290,7 +291,7 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container, useRuntime bool) erro
case "stopped":
ctr.state.State = ContainerStateStopped
default:
- return errors.Wrapf(ErrInternal, "unrecognized status returned by runtime for container %s: %s",
+ return errors.Wrapf(define.ErrInternal, "unrecognized status returned by runtime for container %s: %s",
ctr.ID(), state.Status)
}
@@ -390,11 +391,11 @@ func (r *OCIRuntime) unpauseContainer(ctr *Container) error {
// TODO: add --pid-file and use that to generate exec session tracking
func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty bool, cwd, user, sessionID string, streams *AttachStreams, preserveFDs int) (*exec.Cmd, error) {
if len(cmd) == 0 {
- return nil, errors.Wrapf(ErrInvalidArg, "must provide a command to execute")
+ return nil, errors.Wrapf(define.ErrInvalidArg, "must provide a command to execute")
}
if sessionID == "" {
- return nil, errors.Wrapf(ErrEmptyID, "must provide a session ID for exec")
+ return nil, errors.Wrapf(define.ErrEmptyID, "must provide a session ID for exec")
}
runtimeDir, err := util.GetRootlessRuntimeDir()