Removed ability to mutate user from scheduler library.

The scheduler used to mutate the user field to the os::user if it was
not set. This patch removes this functionality and leaves it upto the
client to provide a user as part of SUBSCRIBE.

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


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

Branch: refs/heads/master
Commit: 8e0d6549d59d5b5b55ab5afe8d2434b76c953363
Parents: cb5c635
Author: Anand Mazumdar <[email protected]>
Authored: Thu Aug 6 09:25:39 2015 -0700
Committer: Vinod Kone <[email protected]>
Committed: Thu Aug 6 09:25:39 2015 -0700

----------------------------------------------------------------------
 src/examples/event_call_framework.cpp |  6 +++++-
 src/scheduler/scheduler.cpp           | 10 ----------
 2 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8e0d6549/src/examples/event_call_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/event_call_framework.cpp 
b/src/examples/event_call_framework.cpp
index 8054068..0093363 100644
--- a/src/examples/event_call_framework.cpp
+++ b/src/examples/event_call_framework.cpp
@@ -396,10 +396,14 @@ int main(int argc, char** argv)
   internal::logging::initialize(argv[0], flags, true); // Catch signals.
 
   FrameworkInfo framework;
-  framework.set_user(""); // Have Mesos fill in the current user.
   framework.set_name("Event Call Scheduler using libprocess (C++)");
   framework.set_role(role);
 
+  const Result<string> user = os::user();
+
+  CHECK_SOME(user);
+  framework.set_user(user.get());
+
   value = os::getenv("MESOS_CHECKPOINT");
   if (value.isSome()) {
     framework.set_checkpoint(

http://git-wip-us.apache.org/repos/asf/mesos/blob/8e0d6549/src/scheduler/scheduler.cpp
----------------------------------------------------------------------
diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index 4c0c80b..a0df048 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -192,16 +192,6 @@ public:
       return;
     }
 
-    // If no user was specified in FrameworkInfo, use the current user.
-    // TODO(benh): Make FrameworkInfo.user be optional.
-    if (call.type() == Call::SUBSCRIBE &&
-        call.subscribe().framework_info().user() == "") {
-      Result<string> user = os::user();
-      CHECK_SOME(user);
-
-      call.mutable_subscribe()->mutable_framework_info()->set_user(user.get());
-    }
-
     Option<Error> error = validation::scheduler::call::validate(call);
 
     if (error.isSome()) {

Reply via email to