| 4452 | |
| 4453 | |
| 4454 | Future<Response> Http::attachContainerOutput( |
| 4455 | const mesos::agent::Call& call, |
| 4456 | const RequestMediaTypes& mediaTypes, |
| 4457 | const Option<Principal>& principal) const |
| 4458 | { |
| 4459 | CHECK_EQ(mesos::agent::Call::ATTACH_CONTAINER_OUTPUT, call.type()); |
| 4460 | CHECK(call.has_attach_container_output()); |
| 4461 | |
| 4462 | LOG(INFO) << "Processing ATTACH_CONTAINER_OUTPUT call for container '" |
| 4463 | << call.attach_container_output().container_id() << "'"; |
| 4464 | return ObjectApprovers::create( |
| 4465 | slave->authorizer, |
| 4466 | principal, |
| 4467 | {ATTACH_CONTAINER_OUTPUT}) |
| 4468 | .then(defer( |
| 4469 | slave->self(), |
| 4470 | [=](const Owned<ObjectApprovers>& approvers) -> Future<Response> { |
| 4471 | const ContainerID& containerId = |
| 4472 | call.attach_container_output().container_id(); |
| 4473 | |
| 4474 | Executor* executor = slave->getExecutor(containerId); |
| 4475 | if (executor == nullptr) { |
| 4476 | return NotFound( |
| 4477 | "Container " + stringify(containerId) + " cannot be found"); |
| 4478 | } |
| 4479 | |
| 4480 | Framework* framework = slave->getFramework(executor->frameworkId); |
| 4481 | CHECK_NOTNULL(framework); |
| 4482 | |
| 4483 | if (!approvers->approved<ATTACH_CONTAINER_OUTPUT>( |
| 4484 | executor->info, framework->info, containerId)) { |
| 4485 | return Forbidden(); |
| 4486 | } |
| 4487 | |
| 4488 | return _attachContainerOutput(call, mediaTypes); |
| 4489 | })); |
| 4490 | } |
| 4491 | |
| 4492 | } // namespace slave { |
| 4493 | } // namespace internal { |
nothing calls this directly
no test coverage detected