You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2015/10/12 19:42:10 UTC
[1/2] mesos git commit: Fixed a bug in teardown test.
Repository: mesos
Updated Branches:
refs/heads/master 1d68eed90 -> df2a1fd1d
Fixed a bug in teardown test.
This teardown endpoint test needs valid credentials to properly test
a missing 'frameworkID' request.
Review: https://reviews.apache.org/r/39135
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a9148f6d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a9148f6d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a9148f6d
Branch: refs/heads/master
Commit: a9148f6d61b6f49ca4489e6fa29ffc90ffd8e948
Parents: 1d68eed
Author: Isabel Jimenez <co...@isabeljimenez.com>
Authored: Mon Oct 12 19:32:16 2015 +0200
Committer: Michael Park <mp...@apache.org>
Committed: Mon Oct 12 19:32:16 2015 +0200
----------------------------------------------------------------------
src/tests/teardown_tests.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/a9148f6d/src/tests/teardown_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/teardown_tests.cpp b/src/tests/teardown_tests.cpp
index 2eeead7..89eb314 100644
--- a/src/tests/teardown_tests.cpp
+++ b/src/tests/teardown_tests.cpp
@@ -264,7 +264,9 @@ TEST_F(TeardownTest, TeardownEndpointNoFrameworkId)
AWAIT_READY(frameworkId);
process::http::Headers headers;
headers["Authorization"] = "Basic " +
- base64::encode("badPrincipal:badSecret");
+ base64::encode(DEFAULT_CREDENTIAL.principal() +
+ ":" + DEFAULT_CREDENTIAL.secret());
+
Future<Response> response =
process::http::post(master.get(), "teardown", headers, "");
AWAIT_READY(response);
[2/2] mesos git commit: Validated `Credential` messages earlier in
the HTTP endpoints.
Posted by mp...@apache.org.
Validated `Credential` messages earlier in the HTTP endpoints.
Review: https://reviews.apache.org/r/39100
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/df2a1fd1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/df2a1fd1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/df2a1fd1
Branch: refs/heads/master
Commit: df2a1fd1d917549118087c66dd3b2f700a12e714
Parents: a9148f6
Author: Isabel Jimenez <co...@isabeljimenez.com>
Authored: Mon Oct 12 19:33:01 2015 +0200
Committer: Michael Park <mp...@apache.org>
Committed: Mon Oct 12 19:33:02 2015 +0200
----------------------------------------------------------------------
src/master/http.cpp | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/df2a1fd1/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 4b9f9ed..76954ac 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -686,6 +686,11 @@ Future<Response> Master::Http::reserve(const Request& request) const
return BadRequest("Expecting POST");
}
+ Result<Credential> credential = authenticate(request);
+ if (credential.isError()) {
+ return Unauthorized("Mesos master", credential.error());
+ }
+
// Parse the query string in the request body.
Try<hashmap<string, string>> decode =
process::http::query::decode(request.body);
@@ -730,11 +735,6 @@ Future<Response> Master::Http::reserve(const Request& request) const
resources += resource.get();
}
- Result<Credential> credential = authenticate(request);
- if (credential.isError()) {
- return Unauthorized("Mesos master", credential.error());
- }
-
// Create an offer operation.
Offer::Operation operation;
operation.set_type(Offer::Operation::RESERVE);
@@ -1234,6 +1234,11 @@ Future<Response> Master::Http::teardown(const Request& request) const
return BadRequest("Expecting POST");
}
+ Result<Credential> credential = authenticate(request);
+ if (credential.isError()) {
+ return Unauthorized("Mesos master", credential.error());
+ }
+
// Parse the query string in the request body (since this is a POST)
// in order to determine the framework ID to shutdown.
Try<hashmap<string, string>> decode =
@@ -1258,12 +1263,6 @@ Future<Response> Master::Http::teardown(const Request& request) const
return BadRequest("No framework found with specified ID");
}
- Result<Credential> credential = authenticate(request);
-
- if (credential.isError()) {
- return Unauthorized("Mesos master", credential.error());
- }
-
// Skip authorization if no ACLs were provided to the master.
if (master->authorizer.isNone()) {
return _teardown(id);
@@ -1833,6 +1832,11 @@ Future<Response> Master::Http::unreserve(const Request& request) const
return BadRequest("Expecting POST");
}
+ Result<Credential> credential = authenticate(request);
+ if (credential.isError()) {
+ return Unauthorized("Mesos master", credential.error());
+ }
+
// Parse the query string in the request body.
Try<hashmap<string, string>> decode =
process::http::query::decode(request.body);
@@ -1877,11 +1881,6 @@ Future<Response> Master::Http::unreserve(const Request& request) const
resources += resource.get();
}
- Result<Credential> credential = authenticate(request);
- if (credential.isError()) {
- return Unauthorized("Mesos master", credential.error());
- }
-
// Create an offer operation.
Offer::Operation operation;
operation.set_type(Offer::Operation::UNRESERVE);