summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-10-10 17:04:32 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-10-11 14:28:41 -0400
commitf00e1e0223491cdd2d193441924965613810cc87 (patch)
treecd82a75863b27a6581889fb8bbacbb91927aa4f8
parentf39e097a815799bad704a8a1d8f16ee86f4c3602 (diff)
downloadpodman-f00e1e0223491cdd2d193441924965613810cc87.tar.gz
podman-f00e1e0223491cdd2d193441924965613810cc87.tar.bz2
podman-f00e1e0223491cdd2d193441924965613810cc87.zip
Allow giving path to Podman for cleanup command
For non-Podman users of Libpod, we don't want to force the exit command to use ARGV[0], which probably does not support a cleanup command. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
-rw-r--r--pkg/spec/createconfig.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index a65263b7d..b7d55b963 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -104,7 +104,8 @@ type CreateConfig struct {
NetworkAlias []string //network-alias
PidMode namespaces.PidMode //pid
Pod string //pod
- CgroupMode namespaces.CgroupMode //cgroup
+ PodmanPath string
+ CgroupMode namespaces.CgroupMode //cgroup
PortBindings nat.PortMap
Privileged bool //privileged
Publish []string //publish
@@ -153,7 +154,16 @@ func (c *CreateConfig) createExitCommand(runtime *libpod.Runtime) ([]string, err
return nil, err
}
- cmd, _ := os.Executable()
+ // We need a cleanup process for containers in the current model.
+ // But we can't assume that the caller is Podman - it could be another
+ // user of the API.
+ // As such, provide a way to specify a path to Podman, so we can
+ // still invoke a cleanup process.
+ cmd := c.PodmanPath
+ if cmd == "" {
+ cmd, _ = os.Executable()
+ }
+
command := []string{cmd,
"--root", config.StorageConfig.GraphRoot,
"--runroot", config.StorageConfig.RunRoot,