diff options
author | baude <bbaude@redhat.com> | 2020-12-23 11:02:52 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-12-23 12:01:46 -0600 |
commit | c81e29525b0ea84107147d92283c2b88909d1f12 (patch) | |
tree | e88e9e8d36811858ecfa026b9ed280f50ee83bae /pkg/domain/infra/tunnel | |
parent | 54b82a175f16f27849e6791f65bf73eccae4701a (diff) | |
download | podman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.gz podman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.bz2 podman-c81e29525b0ea84107147d92283c2b88909d1f12.zip |
add --cidfile to container kill
Add the ability to read container ids from one or more files for the
kill command.
Fixes: #8443
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/domain/infra/tunnel')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 7704de210..0db985dff 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -125,6 +125,14 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin } func (ic *ContainerEngine) ContainerKill(ctx context.Context, namesOrIds []string, opts entities.KillOptions) ([]*entities.KillReport, error) { + for _, cidFile := range opts.CIDFiles { + content, err := ioutil.ReadFile(cidFile) + if err != nil { + return nil, errors.Wrap(err, "error reading CIDFile") + } + id := strings.Split(string(content), "\n")[0] + namesOrIds = append(namesOrIds, id) + } ctrs, err := getContainersByContext(ic.ClientCtx, opts.All, false, namesOrIds) if err != nil { return nil, err |