summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-12-03 08:34:04 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-04 17:53:23 +0000
commit1f482c9f1f919026aff139127639083959a8f021 (patch)
tree084348ef58a86e7d2fc254ab5045ea2a6c79c6ec /libpod/container.go
parent95cb7a11f124b5d095e95a8928d752f38d6b375d (diff)
downloadpodman-1f482c9f1f919026aff139127639083959a8f021.tar.gz
podman-1f482c9f1f919026aff139127639083959a8f021.tar.bz2
podman-1f482c9f1f919026aff139127639083959a8f021.zip
You can only attach to running containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #98 Approved by: mheon
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 31fbbbcc5..60c63d14e 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -598,11 +598,9 @@ func (c *Container) Attach(noStdin bool, keys string, attached chan<- bool) erro
return err
}
- // TODO is it valid to attach to a frozen container?
- if c.state.State == ContainerStateUnknown ||
- c.state.State == ContainerStateConfigured ||
- c.state.State == ContainerStatePaused {
- return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created, running, or stopped containers")
+ if c.state.State != ContainerStateCreated &&
+ c.state.State != ContainerStateRunning {
+ return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created or running containers")
}
// Check the validity of the provided keys first