diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-14 14:34:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 14:34:18 +0200 |
commit | 004826653f2a8b064af8c1f055b1a402f4060d1c (patch) | |
tree | 715f035f049b161b55932fa9586f24c1876f11a5 /pkg/domain/infra | |
parent | 5cf64aee11063bc8e7ff22f1365b0bf6b3ab0900 (diff) | |
parent | d8d1aa49d27d51f914a0858ab99c57d7dc929926 (diff) | |
download | podman-004826653f2a8b064af8c1f055b1a402f4060d1c.tar.gz podman-004826653f2a8b064af8c1f055b1a402f4060d1c.tar.bz2 podman-004826653f2a8b064af8c1f055b1a402f4060d1c.zip |
Merge pull request #5803 from baude/v2init
v2podman add container init
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 14 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 16 |
2 files changed, 30 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 7f8ec210b..a3a0a8202 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -794,3 +794,17 @@ func (ic *ContainerEngine) ContainerCleanup(ctx context.Context, namesOrIds []st } return reports, nil } + +func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []string, options entities.ContainerInitOptions) ([]*entities.ContainerInitReport, error) { + var reports []*entities.ContainerInitReport + ctrs, err := getContainersByContext(options.All, options.Latest, namesOrIds, ic.Libpod) + if err != nil { + return nil, err + } + for _, ctr := range ctrs { + report := entities.ContainerInitReport{Id: ctr.ID()} + report.Err = ctr.Init(ctx) + reports = append(reports, &report) + } + return reports, nil +} diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 2bc3a1914..1a430e3d0 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -338,3 +338,19 @@ func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrId string, _ func (ic *ContainerEngine) ContainerCleanup(ctx context.Context, namesOrIds []string, options entities.ContainerCleanupOptions) ([]*entities.ContainerCleanupReport, error) { return nil, errors.New("not implemented") } + +func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []string, options entities.ContainerInitOptions) ([]*entities.ContainerInitReport, error) { + var reports []*entities.ContainerInitReport + ctrs, err := getContainersByContext(ic.ClientCxt, options.All, namesOrIds) + if err != nil { + return nil, err + } + for _, ctr := range ctrs { + err := containers.ContainerInit(ic.ClientCxt, ctr.ID) + reports = append(reports, &entities.ContainerInitReport{ + Err: err, + Id: ctr.ID, + }) + } + return reports, nil +} |