diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container.go | 4 | ||||
-rw-r--r-- | libpod/container_log.go | 23 | ||||
-rw-r--r-- | libpod/options.go | 2 |
3 files changed, 5 insertions, 24 deletions
diff --git a/libpod/container.go b/libpod/container.go index d4a779b13..20702903e 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -97,6 +97,10 @@ const ( // RestartPolicyOnFailure restarts the container on non-0 exit code, // with an optional maximum number of retries. RestartPolicyOnFailure = "on-failure" + // RestartPolicyUnlessStopped unconditionally restarts unless stopped + // by the user. It is identical to Always except with respect to + // handling of system restart, which Podman does not yet support. + RestartPolicyUnlessStopped = "unless-stopped" ) // Container is a single OCI container. diff --git a/libpod/container_log.go b/libpod/container_log.go index ac4720cfb..071882bc2 100644 --- a/libpod/container_log.go +++ b/libpod/container_log.go @@ -2,7 +2,6 @@ package libpod import ( "os" - "time" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/libpod/logs" @@ -82,27 +81,5 @@ func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *l } options.WaitGroup.Done() }() - // Check if container is still running or paused - go func() { - if options.Follow { - for { - state, err := c.State() - if err != nil && errors.Cause(err) != define.ErrNoSuchCtr { - logrus.Error(err) - break - } else if err != nil { - break - } - if state != define.ContainerStateRunning && state != define.ContainerStatePaused { - err := t.Stop() - if err != nil { - logrus.Error(err) - } - break - } - time.Sleep(1 * time.Second) - } - } - }() return nil } diff --git a/libpod/options.go b/libpod/options.go index 3a5dddbed..ffc9c1018 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1285,7 +1285,7 @@ func WithRestartPolicy(policy string) CtrCreateOption { } switch policy { - case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways: + case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways, RestartPolicyUnlessStopped: ctr.config.RestartPolicy = policy default: return errors.Wrapf(define.ErrInvalidArg, "%q is not a valid restart policy", policy) |