diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-04-01 19:20:03 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-05-03 10:36:16 -0400 |
commit | f4db6d5cf61741f9b0de163b158ecdc2bcfa6669 (patch) | |
tree | 5fe2d6ca45412231af907946e4a31d6efb0c4305 /pkg | |
parent | dc42304f3804632d01345478ab9b1f122b48d516 (diff) | |
download | podman-f4db6d5cf61741f9b0de163b158ecdc2bcfa6669.tar.gz podman-f4db6d5cf61741f9b0de163b158ecdc2bcfa6669.tar.bz2 podman-f4db6d5cf61741f9b0de163b158ecdc2bcfa6669.zip |
Add support for retry count with --restart flag
The on-failure restart option supports restarting only a given
number of times. To do this, we need one additional field in the
DB to track restart count (which conveniently fills a field in
Inspect we weren't populating), plus some plumbing logic.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/inspect/inspect.go | 2 | ||||
-rw-r--r-- | pkg/spec/createconfig.go | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/pkg/inspect/inspect.go b/pkg/inspect/inspect.go index 6978370ef..693755aa8 100644 --- a/pkg/inspect/inspect.go +++ b/pkg/inspect/inspect.go @@ -161,7 +161,7 @@ type ContainerInspectData struct { LogPath string `json:"LogPath"` ConmonPidFile string `json:"ConmonPidFile"` Name string `json:"Name"` - RestartCount int32 `json:"RestartCount"` //TODO + RestartCount int32 `json:"RestartCount"` Driver string `json:"Driver"` MountLabel string `json:"MountLabel"` ProcessLabel string `json:"ProcessLabel"` diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index f1861dd19..9979e773c 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -376,8 +376,7 @@ func (c *CreateConfig) getContainerCreateOptions(runtime *libpod.Runtime, pod *l } options = append(options, libpod.WithRestartRetries(uint(numTries))) } - - options = append(options, libpod.WithRestartPolicy(c.RestartPolicy)) + options = append(options, libpod.WithRestartPolicy(split[0])) } // Always use a cleanup process to clean up Podman after termination |