summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/containers.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-07-09 14:17:41 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-11 19:55:16 +0000
commit7f3f49139694e447a05522efce97d3f8516d0ea2 (patch)
tree021fc8aec4b4be33a1c35c3afad8e6199b7b8c9b /pkg/varlinkapi/containers.go
parent1219a3cab3f0c21d292035f8f9a077ebc5f2ff84 (diff)
downloadpodman-7f3f49139694e447a05522efce97d3f8516d0ea2.tar.gz
podman-7f3f49139694e447a05522efce97d3f8516d0ea2.tar.bz2
podman-7f3f49139694e447a05522efce97d3f8516d0ea2.zip
create conmon sockets when getting their paths
when using the getattachsockets endpoint, which returns the sockets needed to create and use a terminal, we should check if the container is just in the configured state. if so, we need to perform a container init to have conmon create the required sockets so we can attach to them prior to starting the container. Signed-off-by: baude <bbaude@redhat.com> Closes: #1067 Approved by: jwhonce
Diffstat (limited to 'pkg/varlinkapi/containers.go')
-rw-r--r--pkg/varlinkapi/containers.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index 391bbb350..6678b6f7a 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -462,6 +462,20 @@ func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, nam
if err != nil {
return call.ReplyContainerNotFound(name)
}
+
+ status, err := ctr.State()
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+
+ // If the container hasn't been run, we need to run init
+ // so the conmon sockets get created.
+ if status == libpod.ContainerStateConfigured || status == libpod.ContainerStateStopped {
+ if err := ctr.Init(getContext()); err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ }
+
s := ioprojectatomicpodman.Sockets{
Container_id: ctr.ID(),
Io_socket: ctr.AttachSocketPath(),