You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/06/20 13:59:54 UTC

[1/5] mesos git commit: Removed explicit authorization results in Mesos.

Repository: mesos
Updated Branches:
  refs/heads/master e7bf541c9 -> 049da0457


Removed explicit authorization results in Mesos.

Removing the explicit authorization results as formerly returned by
some authorizer invocations in Mesos, the returned future falls
through/back to the HTTP proxy handler of libprocess. This change
allows us to reduce the amount of failure result handlers.

Review: https://reviews.apache.org/r/48918/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dab34046
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dab34046
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dab34046

Branch: refs/heads/master
Commit: dab340464049174644a9b73fe391fa652ddb19db
Parents: e7bf541
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:05 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:05 2016 +0200

----------------------------------------------------------------------
 src/master/http.cpp | 20 ++------------------
 src/slave/http.cpp  |  7 +------
 2 files changed, 3 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/dab34046/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 148324e..ccf0a4e 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -1527,10 +1527,6 @@ Future<Response> Master::Http::getTasks(
 
       return OK(serialize(contentType, response),
                 stringify(contentType));
-    })
-    .repair([](const Future<Response>& response) {
-      LOG(WARNING) << "Authorization failed: " << response.failure();
-      return InternalServerError(response.failure());
     });
 }
 
@@ -2172,11 +2168,7 @@ Future<Response> Master::Http::state(
       };
 
       return OK(jsonify(state), request.url.query.get("jsonp"));
-    }))
-    .repair([](const Future<Response>& response) {
-      LOG(WARNING) << "Authorization failed: " << response.failure();
-      return InternalServerError(response.failure());
-    });
+    }));
 }
 
 
@@ -2488,11 +2480,7 @@ Future<Response> Master::Http::stateSummary(
       };
 
       return OK(jsonify(stateSummary), request.url.query.get("jsonp"));
-    }))
-    .repair([](const Future<Response>& response) {
-      LOG(WARNING) << "Authorization failed: " << response.failure();
-      return InternalServerError(response.failure());
-    });
+    }));
 }
 
 
@@ -2812,10 +2800,6 @@ Future<Response> Master::Http::tasks(
       };
 
       return OK(jsonify(tasksWriter), request.url.query.get("jsonp"));
-    })
-    .repair([](const Future<Response>& response) {
-      LOG(WARNING) << "Authorization failed: " << response.failure();
-      return InternalServerError(response.failure());
     });
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/dab34046/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 7783411..b32afb6 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -899,12 +899,7 @@ Future<Response> Slave::Http::statistics(
                   [this, request](const ResourceUsage& usage) {
               return _statistics(usage, request);
             }));
-        }))
-    .repair([](const Future<Response>& future) {
-      LOG(WARNING) << "Could not collect statistics: " << future.failure();
-
-      return InternalServerError();
-    });
+        }));
 }
 
 


[3/5] mesos git commit: Updated the HTTP result returned by failures of authn/authz.

Posted by ti...@apache.org.
Updated the HTTP result returned by failures of authn/authz.

Changes authentication and authorization happening on the libprocess
level to be in line with failures possibly returned by Mesos
authorization as currently implemented by the HTTPProxy::process
function. The HTTP result returned on failures has changed from
InternalServerError (500) towards ServiceNotAvailable (503) and now
contains a message describing the problem.

Review: https://reviews.apache.org/r/48920/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/56a49b28
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/56a49b28
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/56a49b28

Branch: refs/heads/master
Commit: 56a49b28596c263dd3f17d948bbb2ad2f7177ec8
Parents: bb95476
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:21 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:21 2016 +0200

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/56a49b28/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 1cb2866..4a9b1ff 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3332,7 +3332,10 @@ void ProcessBase::visit(const HttpEvent& event)
       .onAny(defer(self(), [this, endpoint, request, response, name, id](
           const Future<Option<AuthenticationResult>>& authentication) {
         if (!authentication.isReady()) {
-          response->set(InternalServerError());
+          response->set(
+              authentication.isFailed()
+                ? ServiceUnavailable(authentication.failure())
+                : ServiceUnavailable());
 
           VLOG(1) << "Returning '" << response->future()->status << "'"
                   << " for '" << request.url.path << "'"
@@ -3391,7 +3394,10 @@ void ProcessBase::visit(const HttpEvent& event)
           .onAny(defer(self(), [endpoint, request, response, principal](
               const Future<bool>& authorization) {
             if (!authorization.isReady()) {
-              response->set(InternalServerError());
+              response->set(
+                  authorization.isFailed()
+                    ? ServiceUnavailable(authorization.failure())
+                    : ServiceUnavailable());
 
               VLOG(1) << "Returning '" << response->future()->status << "'"
                       << " for '" << request.url.path << "'"


[5/5] mesos git commit: Updated CHANGELOG to include note about '503' on authorizer failures.

Posted by ti...@apache.org.
Updated CHANGELOG to include note about '503' on authorizer failures.

Review: https://reviews.apache.org/r/48932/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/049da045
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/049da045
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/049da045

Branch: refs/heads/master
Commit: 049da0457882b92e3d7b76aed3c7814684a72290
Parents: 4fa66bc
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:32 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:32 2016 +0200

----------------------------------------------------------------------
 CHANGELOG | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/049da045/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index aed5630..0fc545f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -157,6 +157,10 @@ Additional API Changes:
   * [MESOS-5064] - Remove default value for the agent `work_dir`. This flag is
     now required, and the agent will exit immediately if it is not provided.
 
+  * [MESOS-5637] - Authorized endpoints consistently return `503` (Service
+    Unavailable) instead of `500` (Internal Server Error) when the authenticator
+    or the authorizer fails to process the request.
+
 3rd Party Upgrades:
   * [MESOS-4805] - Upgraded vendored ry-http-parser-1c3624a to nodejs/http-parser 2.6.1.
   * [MESOS-4678] - Upgraded vendored protobuf 2.5.0 to 2.6.1.


[4/5] mesos git commit: Updated test to expect ServiceUnavailable.

Posted by ti...@apache.org.
Updated test to expect ServiceUnavailable.

StatisticsEndpointGetResourceUsageFailed was expecting an
InternalServerError but instead it will now receive a
ServiceUnavailable.

Review: https://reviews.apache.org/r/48923/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4fa66bc1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4fa66bc1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4fa66bc1

Branch: refs/heads/master
Commit: 4fa66bc138213da1d6e042f9b5b7dce4583e84de
Parents: 56a49b2
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:26 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:26 2016 +0200

----------------------------------------------------------------------
 src/tests/slave_tests.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4fa66bc1/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index ad36b74..5bb6322 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -1761,7 +1761,7 @@ TEST_F(SlaveTest, StatisticsEndpointGetResourceUsageFailed)
 
   AWAIT_READY(response);
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-      InternalServerError().status, response);
+      ServiceUnavailable().status, response);
 
   terminate(slave);
   wait(slave);


[2/5] mesos git commit: Updated HTTPProxy to return a failure message in the HTTP result.

Posted by ti...@apache.org.
Updated HTTPProxy to return a failure message in the HTTP result.

Review: https://reviews.apache.org/r/48919/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bb954769
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bb954769
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bb954769

Branch: refs/heads/master
Commit: bb9547694f2cfec5462497c73969a59af4652957
Parents: dab3404
Author: Till Toenshoff <to...@me.com>
Authored: Mon Jun 20 15:58:13 2016 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 20 15:58:13 2016 +0200

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bb954769/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 703f673..1cb2866 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -1214,7 +1214,19 @@ bool HttpProxy::process(const Future<Response>& future, const Request& request)
   if (!future.isReady()) {
     // TODO(benh): Consider handling other "states" of future
     // (discarded, failed, etc) with different HTTP statuses.
-    socket_manager->send(ServiceUnavailable(), request, socket);
+    Response response = future.isFailed()
+      ? ServiceUnavailable(future.failure())
+      : ServiceUnavailable();
+
+    VLOG(1) << "Returning '" << response.status << "'"
+            << " for '" << request.url.path << "'"
+            << " ("
+            << (future.isFailed()
+                  ? future.failure()
+                  : "discarded") << ")";
+
+    socket_manager->send(response, request, socket);
+
     return true; // All done, can process next response.
   }