summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-02-16 05:17:52 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-02-16 06:26:51 -0500
commit4a9bd7a18f2db7db103a94287ef34cbd1be1626b (patch)
treebb55c84c2e37c1fdb9b03c56d38078020ab78f58 /pkg/domain/infra/abi/containers.go
parentdf8ba7f4a92750bfb173b5486a663d1735d70b2d (diff)
downloadpodman-4a9bd7a18f2db7db103a94287ef34cbd1be1626b.tar.gz
podman-4a9bd7a18f2db7db103a94287ef34cbd1be1626b.tar.bz2
podman-4a9bd7a18f2db7db103a94287ef34cbd1be1626b.zip
When stopping a container, print rawInput
When we stop a container we are printing the full id, this does not match Docker behaviour or the start behavior. We should be printing the users rawInput when we successfully stop the container. Fixes: https://github.com/containers/podman/issues/9386 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 7a672d863..9bef97a5c 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -138,10 +138,16 @@ func (ic *ContainerEngine) ContainerUnpause(ctx context.Context, namesOrIds []st
}
func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []string, options entities.StopOptions) ([]*entities.StopReport, error) {
names := namesOrIds
- ctrs, err := getContainersByContext(options.All, options.Latest, names, ic.Libpod)
+ ctrs, rawInputs, err := getContainersAndInputByContext(options.All, options.Latest, names, ic.Libpod)
if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr) {
return nil, err
}
+ ctrMap := map[string]string{}
+ if len(rawInputs) == len(ctrs) {
+ for i := range ctrs {
+ ctrMap[ctrs[i].ID()] = rawInputs[i]
+ }
+ }
errMap, err := parallelctr.ContainerOp(ctx, ctrs, func(c *libpod.Container) error {
var err error
if options.Timeout != nil {
@@ -174,6 +180,11 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
for ctr, err := range errMap {
report := new(entities.StopReport)
report.Id = ctr.ID()
+ if options.All {
+ report.RawInput = ctr.ID()
+ } else {
+ report.RawInput = ctrMap[ctr.ID()]
+ }
report.Err = err
reports = append(reports, report)
}