| 3722 | |
| 3723 | template <mesos::authorization::Action action> |
| 3724 | Future<Response> Http::_killContainer( |
| 3725 | const ContainerID& containerId, |
| 3726 | const int signal, |
| 3727 | ContentType acceptType, |
| 3728 | const Owned<ObjectApprovers>& approvers) const |
| 3729 | { |
| 3730 | // Attempt to get the executor associated with this ContainerID. |
| 3731 | // We only expect to get the executor when killing a nested container |
| 3732 | // under a container launched via a scheduler. In other cases, we are |
| 3733 | // killing a standalone container (possibly nested). |
| 3734 | Executor* executor = slave->getExecutor(containerId); |
| 3735 | if (executor == nullptr) { |
| 3736 | if (!approvers->approved<action>(containerId)) { |
| 3737 | return Forbidden(); |
| 3738 | } |
| 3739 | } else { |
| 3740 | Framework* framework = slave->getFramework(executor->frameworkId); |
| 3741 | CHECK_NOTNULL(framework); |
| 3742 | |
| 3743 | if (!approvers->approved<action>( |
| 3744 | executor->info, |
| 3745 | framework->info, |
| 3746 | containerId)) { |
| 3747 | return Forbidden(); |
| 3748 | } |
| 3749 | } |
| 3750 | |
| 3751 | Future<bool> kill = slave->containerizer->kill(containerId, signal); |
| 3752 | |
| 3753 | return kill |
| 3754 | .then([containerId](bool found) -> Response { |
| 3755 | if (!found) { |
| 3756 | return NotFound("Container '" + stringify(containerId) + "'" |
| 3757 | " cannot be found (or is already killed)"); |
| 3758 | } |
| 3759 | return OK(); |
| 3760 | }); |
| 3761 | } |
| 3762 | |
| 3763 | |
| 3764 | Future<Response> Http::removeNestedContainer( |
nothing calls this directly
no test coverage detected