diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-22 13:06:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 13:06:53 +0000 |
commit | 6900b5a2be3854d3d109f5fff546bea4de91ac92 (patch) | |
tree | 9eda94b7baa20f61a2f172b86a417a5d872cb724 /pkg/domain/infra | |
parent | 141688cd6fedc02c2f267020095f0ceae15934f5 (diff) | |
parent | f949cfddaa0ff47247df8424d7ddb793088b49e2 (diff) | |
download | podman-6900b5a2be3854d3d109f5fff546bea4de91ac92.tar.gz podman-6900b5a2be3854d3d109f5fff546bea4de91ac92.tar.bz2 podman-6900b5a2be3854d3d109f5fff546bea4de91ac92.zip |
Merge pull request #7717 from rhatdan/attach
Fix up attach tests for podman remote
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 3e99b73b6..d0f90d900 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -389,6 +389,15 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, } func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, options entities.AttachOptions) error { + ctrs, err := getContainersByContext(ic.ClientCxt, false, false, []string{nameOrID}) + if err != nil { + return err + } + ctr := ctrs[0] + if ctr.State != define.ContainerStateRunning.String() { + return errors.Errorf("you can only attach to running containers") + } + return containers.Attach(ic.ClientCxt, nameOrID, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr, nil) } |