Repository: mesos Updated Branches: refs/heads/master 769701ce3 -> c4873eac1
Authenticated the agent's '/containers' endpoint. Review: https://reviews.apache.org/r/47061/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c4873eac Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c4873eac Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c4873eac Branch: refs/heads/master Commit: c4873eac1d7e9df4bc70e2aaf60903f4883fa234 Parents: 769701c Author: Abhishek Dasgupta <a10gu...@linux.vnet.ibm.com> Authored: Mon May 16 20:13:17 2016 +0200 Committer: Alexander Rukletsov <al...@apache.org> Committed: Mon May 16 20:13:17 2016 +0200 ---------------------------------------------------------------------- docs/endpoints/slave/containers.md | 7 ++++++- src/slave/http.cpp | 7 +++++-- src/slave/slave.cpp | 6 ++++-- src/slave/slave.hpp | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c4873eac/docs/endpoints/slave/containers.md ---------------------------------------------------------------------- diff --git a/docs/endpoints/slave/containers.md b/docs/endpoints/slave/containers.md index ae6559b..959f40b 100644 --- a/docs/endpoints/slave/containers.md +++ b/docs/endpoints/slave/containers.md @@ -45,4 +45,9 @@ Example (**Note**: this is not exhaustive): "timestamp":1388534400.0 } }] -``` \ No newline at end of file +``` + + +### AUTHENTICATION ### +This endpoint requires authentication iff HTTP authentication is +enabled. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mesos/blob/c4873eac/src/slave/http.cpp ---------------------------------------------------------------------- diff --git a/src/slave/http.cpp b/src/slave/http.cpp index c5d6a7a..fb48ec6 100644 --- a/src/slave/http.cpp +++ b/src/slave/http.cpp @@ -743,11 +743,14 @@ string Slave::Http::CONTAINERS_HELP() " \"timestamp\":1388534400.0", " }", "}]", - "```")); + "```"), + AUTHENTICATION(true)); } -Future<Response> Slave::Http::containers(const Request& request) const +Future<Response> Slave::Http::containers( + const Request& request, + const Option<string>& /* principal */) const { Owned<list<JSON::Object>> metadata(new list<JSON::Object>()); list<Future<ContainerStatus>> statusFutures; http://git-wip-us.apache.org/repos/asf/mesos/blob/c4873eac/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index bea35e5..869d342 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -759,9 +759,11 @@ void Slave::initialize() return http.statistics(request, principal); }); route("/containers", + DEFAULT_HTTP_AUTHENTICATION_REALM, Http::CONTAINERS_HELP(), - [http](const process::http::Request& request) { - return http.containers(request); + [http](const process::http::Request& request, + const Option<string>& principal) { + return http.containers(request, principal); }); // Expose the log file for the webui. Fall back to 'log_dir' if http://git-wip-us.apache.org/repos/asf/mesos/blob/c4873eac/src/slave/slave.hpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp index 89e3348..209f071 100644 --- a/src/slave/slave.hpp +++ b/src/slave/slave.hpp @@ -457,7 +457,8 @@ private: // /slave/containers process::Future<process::http::Response> containers( - const process::http::Request& request) const; + const process::http::Request& request, + const Option<std::string>& /* principal */) const; static std::string EXECUTOR_HELP(); static std::string FLAGS_HELP();