summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/containers_remote.go11
-rw-r--r--pkg/varlinkapi/containers.go3
2 files changed, 13 insertions, 1 deletions
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go
index 268ac09e8..d1e4b4dcd 100644
--- a/pkg/adapter/containers_remote.go
+++ b/pkg/adapter/containers_remote.go
@@ -251,7 +251,16 @@ func (r *LocalRuntime) InitContainers(ctx context.Context, cli *cliconfig.InitVa
for _, id := range ids {
initialized, err := iopodman.InitContainer().Call(r.Conn, id)
if err != nil {
- failures[id] = err
+ if cli.All {
+ switch err.(type) {
+ case *iopodman.InvalidState:
+ ok = append(ok, initialized)
+ default:
+ failures[id] = err
+ }
+ } else {
+ failures[id] = err
+ }
} else {
ok = append(ok, initialized)
}
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index 861e3210b..c8be41636 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -372,6 +372,9 @@ func (i *LibpodAPI) InitContainer(call iopodman.VarlinkCall, name string) error
return call.ReplyContainerNotFound(name, err.Error())
}
if err := ctr.Init(getContext()); err != nil {
+ if errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ return call.ReplyInvalidState(ctr.ID(), err.Error())
+ }
return call.ReplyErrorOccurred(err.Error())
}
return call.ReplyInitContainer(ctr.ID())