libpod: reset state error on init

If we manage to init/start a container successfully we should unset any
previously stored state errors. Otherwise a user might be confused why
there is an error in the state about some old error even though the
container works/runs.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-08-12 11:47:23 +02:00
parent 78cb1e28cb
commit ecf88f17b6

View File

@ -1106,6 +1106,9 @@ func (c *Container) init(ctx context.Context, retainRetries bool) error {
c.state.RestoreLog = ""
c.state.ExitCode = 0
c.state.Exited = false
// Reset any previous errors as we try to init it again, either it works and we don't
// want to keep an old error around or a new error will be written anyway.
c.state.Error = ""
c.state.State = define.ContainerStateCreated
c.state.StoppedByUser = false
c.state.RestartPolicyMatch = false