You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/10/15 00:12:20 UTC

[2/2] mesos git commit: Updated default value of the '--runtime_dir' agent flag.

Updated default value of the '--runtime_dir' agent flag.

Previously, the default value of '--runtime_dir' was hard coded to
'/var/run/mesos'. However, this directory is typically only accessable
to the 'root' user. This caused problems when launching an agent as a
non-root user. We now check to see if the agent is launched as root or
not, and change this default accordingly.

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


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

Branch: refs/heads/master
Commit: df1b91f6f0012f671f908b35a047830898f41803
Parents: 6a47d0d
Author: Kevin Klues <kl...@gmail.com>
Authored: Fri Oct 14 17:10:14 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Oct 14 17:12:07 2016 -0700

----------------------------------------------------------------------
 src/slave/constants.hpp |  2 +-
 src/slave/flags.cpp     | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/df1b91f6/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 0640721..6c381f0 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -141,7 +141,7 @@ Duration DEFAULT_MASTER_PING_TIMEOUT();
 // Default path of the agent runtime directory. This is where runtime
 // data is stored by an agent that it needs to persist across crashes
 // (but not across reboots). This directory will be cleared on reboot.
-constexpr char DEFAULT_RUNTIME_DIRECTORY[] = "/var/run/mesos";
+constexpr char DEFAULT_ROOT_RUNTIME_DIRECTORY[] = "/var/run/mesos";
 
 // Name of the executable for default executor.
 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";

http://git-wip-us.apache.org/repos/asf/mesos/blob/df1b91f6/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 08f534f..87d9e46 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -208,7 +208,16 @@ mesos::internal::slave::Flags::Flags()
       "is stored by an agent that it needs to persist across crashes (but\n"
       "not across reboots). This directory will be cleared on reboot.\n"
       "(Example: `/var/run/mesos`)",
-      DEFAULT_RUNTIME_DIRECTORY);
+      []() -> string {
+        Result<string> user = os::user();
+        CHECK_SOME(user);
+
+        if (user.get() == "root") {
+            return DEFAULT_ROOT_RUNTIME_DIRECTORY;
+        } else {
+            return path::join(os::temp(), "mesos", "runtime");
+        }
+      }());
 
   add(&Flags::launcher_dir, // TODO(benh): This needs a better name.
       "launcher_dir",