| 905 | |
| 906 | |
| 907 | Future<Option<int>> CheckerProcess::waitNestedContainer( |
| 908 | const ContainerID& containerId, |
| 909 | runtime::Nested nested) |
| 910 | { |
| 911 | agent::Call call; |
| 912 | call.set_type(agent::Call::WAIT_NESTED_CONTAINER); |
| 913 | |
| 914 | agent::Call::WaitNestedContainer* containerWait = |
| 915 | call.mutable_wait_nested_container(); |
| 916 | |
| 917 | containerWait->mutable_container_id()->CopyFrom(containerId); |
| 918 | |
| 919 | http::Request request; |
| 920 | request.method = "POST"; |
| 921 | request.url = nested.agentURL; |
| 922 | request.body = serialize(ContentType::PROTOBUF, evolve(call)); |
| 923 | request.headers = {{"Accept", stringify(ContentType::PROTOBUF)}, |
| 924 | {"Content-Type", stringify(ContentType::PROTOBUF)}}; |
| 925 | |
| 926 | if (nested.authorizationHeader.isSome()) { |
| 927 | request.headers["Authorization"] = nested.authorizationHeader.get(); |
| 928 | } |
| 929 | |
| 930 | // TODO(alexr): Use a lambda named capture for |
| 931 | // this cached value once it is available. |
| 932 | const string _name = name; |
| 933 | |
| 934 | return http::request(request, false) |
| 935 | .repair([containerId, _name](const Future<http::Response>& future) { |
| 936 | return Failure( |
| 937 | "Connection to wait for " + _name + " container '" + |
| 938 | stringify(containerId) + "' failed: " + future.failure()); |
| 939 | }) |
| 940 | .then(defer(self(), |
| 941 | &Self::_waitNestedContainer, containerId, lambda::_1)); |
| 942 | } |
| 943 | |
| 944 | |
| 945 | Future<Option<int>> CheckerProcess::_waitNestedContainer( |
nothing calls this directly
no test coverage detected