summaryrefslogtreecommitdiff
path: root/pkg/adapter/containers.go
diff options
context:
space:
mode:
authorDanila Kiver <danila.kiver@mail.ru>2019-07-04 03:58:37 +0300
committerDanila Kiver <danila.kiver@mail.ru>2019-07-04 03:58:37 +0300
commita54429cf877e899eb1516e3ee71ae9c6eedd7c5a (patch)
treefe676086d21daefe2f1650efbbe7bd2cd7fa1217 /pkg/adapter/containers.go
parentf5593d305f68409cf093ea6b66a9d1f121ec0fd6 (diff)
downloadpodman-a54429cf877e899eb1516e3ee71ae9c6eedd7c5a.tar.gz
podman-a54429cf877e899eb1516e3ee71ae9c6eedd7c5a.tar.bz2
podman-a54429cf877e899eb1516e3ee71ae9c6eedd7c5a.zip
Use conmon pidfile in generated systemd unit as PIDFile.
By default, podman points PIDFile in generated unit file to non-existent location. As a result, the unit file, generated by podman, is broken: an attempt to start this unit without prior modification results in a crash, because systemd can not find the pidfile of service's main process. Fix the value of "PIDFile" and add a system test for this case. Signed-off-by: Danila Kiver <danila.kiver@mail.ru>
Diffstat (limited to 'pkg/adapter/containers.go')
-rw-r--r--pkg/adapter/containers.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go
index 10720886b..0ea89a72c 100644
--- a/pkg/adapter/containers.go
+++ b/pkg/adapter/containers.go
@@ -1058,7 +1058,14 @@ func (r *LocalRuntime) GenerateSystemd(c *cliconfig.GenerateSystemdValues) (stri
if c.Name {
name = ctr.Name()
}
- return systemdgen.CreateSystemdUnitAsString(name, ctr.ID(), c.RestartPolicy, ctr.Config().StaticDir, timeout)
+
+ config := ctr.Config()
+ conmonPidFile := config.ConmonPidFile
+ if conmonPidFile == "" {
+ return "", errors.Errorf("conmon PID file path is empty, try to recreate the container with --conmon-pidfile flag")
+ }
+
+ return systemdgen.CreateSystemdUnitAsString(name, ctr.ID(), c.RestartPolicy, conmonPidFile, timeout)
}
// GetNamespaces returns namespace information about a container for PS