MCPcopy Create free account
hub / github.com/apache/mesos / _teardown

Method _teardown

src/master/http.cpp:2783–2820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2781
2782
2783Future<Response> Master::Http::_teardown(
2784 const FrameworkID& id,
2785 const Option<Principal>& principal) const
2786{
2787 Framework* framework = master->getFramework(id);
2788
2789 if (framework == nullptr) {
2790 return BadRequest("No framework found with specified ID");
2791 }
2792
2793 // Skip authorization if no ACLs were provided to the master.
2794 if (master->authorizer.isNone()) {
2795 return __teardown(id);
2796 }
2797
2798 authorization::Request teardown;
2799 teardown.set_action(authorization::TEARDOWN_FRAMEWORK);
2800
2801 Option<authorization::Subject> subject = createSubject(principal);
2802 if (subject.isSome()) {
2803 teardown.mutable_subject()->CopyFrom(subject.get());
2804 }
2805
2806 if (framework->info.has_principal()) {
2807 teardown.mutable_object()->mutable_framework_info()->CopyFrom(
2808 framework->info);
2809 teardown.mutable_object()->set_value(framework->info.principal());
2810 }
2811
2812 return master->authorizer.get()->authorized(teardown)
2813 .then(defer(master->self(), [=](bool authorized) -> Future<Response> {
2814 if (!authorized) {
2815 return Forbidden();
2816 }
2817
2818 return __teardown(id);
2819 }));
2820}
2821
2822
2823Future<Response> Master::Http::__teardown(const FrameworkID& id) const

Callers

nothing calls this directly

Calls 13

BadRequestClass · 0.85
createSubjectFunction · 0.85
deferFunction · 0.85
ForbiddenClass · 0.85
CopyFromMethod · 0.80
principalMethod · 0.80
getFrameworkMethod · 0.45
isNoneMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
thenMethod · 0.45
authorizedMethod · 0.45

Tested by

no test coverage detected