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
This commit is contained in:
parent
1219a3cab3
commit
7f3f491396
|
|
@ -462,6 +462,20 @@ func (i *LibpodAPI) GetAttachSockets(call ioprojectatomicpodman.VarlinkCall, nam
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name)
|
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{
|
s := ioprojectatomicpodman.Sockets{
|
||||||
Container_id: ctr.ID(),
|
Container_id: ctr.ID(),
|
||||||
Io_socket: ctr.AttachSocketPath(),
|
Io_socket: ctr.AttachSocketPath(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue