containers, init: skip invalid state errors with --all

reintroduce the same check that exists in v1.9.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2020-04-24 16:52:55 +02:00
parent 81c7a2444c
commit bd7cad775a
2 changed files with 7 additions and 2 deletions

View File

@ -837,7 +837,13 @@ func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []strin
}
for _, ctr := range ctrs {
report := entities.ContainerInitReport{Id: ctr.ID()}
report.Err = ctr.Init(ctx)
err := ctr.Init(ctx)
// If we're initializing all containers, ignore invalid state errors
if options.All && errors.Cause(err) == define.ErrCtrStateInvalid {
err = nil
}
report.Err = err
reports = append(reports, &report)
}
return reports, nil

View File

@ -16,7 +16,6 @@ var _ = Describe("Podman init", func() {
)
BeforeEach(func() {
Skip(v2fail)
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)