| 513 | |
| 514 | |
| 515 | Future<Nothing> ServiceManagerProcess::waitContainer( |
| 516 | const ContainerID& containerId) |
| 517 | { |
| 518 | agent::Call call; |
| 519 | call.set_type(agent::Call::WAIT_CONTAINER); |
| 520 | call.mutable_wait_container()->mutable_container_id()->CopyFrom(containerId); |
| 521 | |
| 522 | return http::post( |
| 523 | agentUrl, |
| 524 | headers, |
| 525 | internal::serialize(contentType, internal::evolve(call)), |
| 526 | stringify(contentType)) |
| 527 | .then([containerId](const http::Response& response) -> Future<Nothing> { |
| 528 | if (response.status != http::OK().status && |
| 529 | response.status != http::NotFound().status) { |
| 530 | return Failure( |
| 531 | "Failed to wait for container '" + stringify(containerId) + |
| 532 | "': Unexpected response '" + response.status + "' (" + response.body |
| 533 | + ")"); |
| 534 | } |
| 535 | |
| 536 | return Nothing(); |
| 537 | }); |
| 538 | } |
| 539 | |
| 540 | |
| 541 | Future<Nothing> ServiceManagerProcess::killContainer( |